pw_sync_embos#
Pigweed AI summary: The pw_sync_embos is a set of backends for pw_sync based on embOS v4. The critical section lock primitives include Mutex & TimedMutex, which use OS_RSEMA as the underlying type and are created using OS_CreateRSema and cleaned up using OS_DeleteRSema. The InterruptSpinLock is backed by a bool and uses OS_IncDI, OS_DecRI, OS_SuspendAllTasks, and OS_ResumeAllSuspendedTasks to mask interrupts and prevent accidental
This is a set of backends for pw_sync based on embOS v4.
Critical Section Lock Primitives#
Pigweed AI summary: This article discusses the critical section lock primitives used in the embOS v4 backend, specifically the Mutex and TimedMutex, as well as the InterruptSpinLock. The Mutex and TimedMutex use OS_RSEMA as the underlying type and are created and cleaned up using OS_CreateRSema and OS_DeleteRSema, respectively. The InterruptSpinLock is backed by a bool and uses OS_IncDI, OS_DecRI, OS_SuspendAllTasks, and OS_ResumeAllSuspended
Mutex & TimedMutex#
Pigweed AI summary: The Mutex and TimedMutex in embOS v4 use OS_RSEMA as the underlying type, created with OS_CreateRSema in constructors and cleaned up with OS_DeleteRSema in destructors.
The embOS v4 backend for the Mutex and TimedMutex use OS_RSEMA
as the
underlying type. It is created using OS_CreateRSema
as part of the
constructors and cleaned up using OS_DeleteRSema
in the destructors.
InterruptSpinLock#
Pigweed AI summary: The InterruptSpinLock in embOS v4 uses a bool to detect accidental recursive locking and uses OS_IncDI and OS_DecRI to mask interrupts for the critical section. It also uses OS_SuspendAllTasks and OS_ResumeAllSuspendedTasks to prevent accidental thread context switches while locked.
The embOS v4 backend for InterruptSpinLock is backed by a bool
which permits
these objects to detect accidental recursive locking.
This object uses OS_IncDI
and OS_DecRI
to mask interrupts which enables
the critical section. In addition, OS_SuspendAllTasks
and
OS_ResumeAllSuspendedTasks
are used to to prevent accidental thread context
switches while the InterruptSpinLock is locked.
Signaling Primitives#
Pigweed AI summary: The article discusses signaling primitives in the embOS v4 implementation of semaphores. It recommends using binary semaphore backends for ThreadNotifications, specifically pw_sync:binary_semaphore_thread_notification_backend and pw_sync:binary_semaphore_timed_thread_notification_backend. The article also mentions that the embOS v4 backends for BinarySemaphore and CountingSemaphore use OS_CSEMA as the underlying type, created using OS_CreateCSema and cleaned up using OS_DeleteCSema.
ThreadNotification & TimedThreadNotification#
Pigweed AI summary: The embOS v4 implementation of semaphores is highly efficient, and it is recommended to use the binary semaphore backends for ThreadNotifications, specifically the pw_sync:binary_semaphore_thread_notification_backend and pw_sync:binary_semaphore_timed_thread_notification_backend.
The native embOS v4 implementation of its semaphores (OS_CSEMA
) is very
efficient, ergo we recommend using the binary semaphore backends for
ThreadNotifications:
- pw_sync:binary_semaphore_thread_notification_backend
- pw_sync:binary_semaphore_timed_thread_notification_backend
BinarySemaphore & CountingSemaphore#
Pigweed AI summary: The embOS v4 backends for BinarySemaphore and CountingSemaphore use OS_CSEMA as the underlying type, which is created using OS_CreateCSema in the constructor and cleaned up using OS_DeleteCSema in the destructor.
The embOS v4 backends for the BinarySemaphore and CountingSemaphore use
OS_CSEMA
as the underlying type. It is created using OS_CreateCSema
as
part of the constructor and cleaned up using OS_DeleteCSema
in the
destructor.