1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_sync_embos: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker============= 4*61c4878aSAndroid Build Coastguard Workerpw_sync_embos 5*61c4878aSAndroid Build Coastguard Worker============= 6*61c4878aSAndroid Build Coastguard WorkerThis is a set of backends for pw_sync based on embOS v4. 7*61c4878aSAndroid Build Coastguard Worker 8*61c4878aSAndroid Build Coastguard Worker-------------------------------- 9*61c4878aSAndroid Build Coastguard WorkerCritical Section Lock Primitives 10*61c4878aSAndroid Build Coastguard Worker-------------------------------- 11*61c4878aSAndroid Build Coastguard Worker 12*61c4878aSAndroid Build Coastguard WorkerMutex & TimedMutex 13*61c4878aSAndroid Build Coastguard Worker================== 14*61c4878aSAndroid Build Coastguard WorkerThe embOS v4 backend for the Mutex and TimedMutex use ``OS_RSEMA`` as the 15*61c4878aSAndroid Build Coastguard Workerunderlying type. It is created using ``OS_CreateRSema`` as part of the 16*61c4878aSAndroid Build Coastguard Workerconstructors and cleaned up using ``OS_DeleteRSema`` in the destructors. 17*61c4878aSAndroid Build Coastguard Worker 18*61c4878aSAndroid Build Coastguard WorkerInterruptSpinLock 19*61c4878aSAndroid Build Coastguard Worker================= 20*61c4878aSAndroid Build Coastguard WorkerThe embOS v4 backend for InterruptSpinLock is backed by a ``bool`` which permits 21*61c4878aSAndroid Build Coastguard Workerthese objects to detect accidental recursive locking. 22*61c4878aSAndroid Build Coastguard Worker 23*61c4878aSAndroid Build Coastguard WorkerThis object uses ``OS_IncDI`` and ``OS_DecRI`` to mask interrupts which enables 24*61c4878aSAndroid Build Coastguard Workerthe critical section. In addition, ``OS_SuspendAllTasks`` and 25*61c4878aSAndroid Build Coastguard Worker``OS_ResumeAllSuspendedTasks`` are used to to prevent accidental thread context 26*61c4878aSAndroid Build Coastguard Workerswitches while the InterruptSpinLock is locked. 27*61c4878aSAndroid Build Coastguard Worker 28*61c4878aSAndroid Build Coastguard Worker-------------------- 29*61c4878aSAndroid Build Coastguard WorkerSignaling Primitives 30*61c4878aSAndroid Build Coastguard Worker-------------------- 31*61c4878aSAndroid Build Coastguard Worker 32*61c4878aSAndroid Build Coastguard WorkerThreadNotification & TimedThreadNotification 33*61c4878aSAndroid Build Coastguard Worker============================================ 34*61c4878aSAndroid Build Coastguard WorkerPrefer using the binary semaphore backends for ThreadNotifications, as the 35*61c4878aSAndroid Build Coastguard Workernative embOS v4 implementation of its semaphores (``OS_CSEMA``) is very 36*61c4878aSAndroid Build Coastguard Workerefficient: 37*61c4878aSAndroid Build Coastguard Worker 38*61c4878aSAndroid Build Coastguard Worker- ``pw_sync:binary_semaphore_thread_notification_backend`` 39*61c4878aSAndroid Build Coastguard Worker- ``pw_sync:binary_semaphore_timed_thread_notification_backend`` 40*61c4878aSAndroid Build Coastguard Worker 41*61c4878aSAndroid Build Coastguard WorkerBinarySemaphore & CountingSemaphore 42*61c4878aSAndroid Build Coastguard Worker=================================== 43*61c4878aSAndroid Build Coastguard WorkerThe embOS v4 backends for the BinarySemaphore and CountingSemaphore use 44*61c4878aSAndroid Build Coastguard Worker``OS_CSEMA`` as the underlying type. It is created using ``OS_CreateCSema`` as 45*61c4878aSAndroid Build Coastguard Workerpart of the constructor and cleaned up using ``OS_DeleteCSema`` in the 46*61c4878aSAndroid Build Coastguard Workerdestructor. 47