-
Philippe Gerum authored
A STAge eXclusion lock (aka stax) serializes in-band vs out-of-band thread activities for accessing a resource. Multiple threads which run on the same execution stage can own the resource concurrently, threads from the converse stage have to wait until the last thread dropped the innermost lock. In other words, at any point in time, the resource is either: - owned by out-of-band threads exclusively - owned by in-band threads exclusively - not owned by any thread Sleeping while owning a stax whether from the in-band or out-of-band stage is ok, although this may defer threads running on the converse stage which may want to access the same resource. For this reason, a stax is definitely not designed for guaranteeing low latency to out-of-band threads, but merely as a way to allow safe sharing of some resource between both stages in case strictly reserving access to out-of-band threads by construction is not a practical option. Other serialization means such as mutexes (either regular in-band ones or EVL) should be used to enforce mutual exclusion among threads running on the same stage which may still concurrently run through a staxed section. Signed-off-by: Philippe Gerum <rpm@xenomai.org>
6c19d25f