![]() |
![]() |
![]() |
![]() |
Create a synchronization object
![]() |
Don't use the SyncTypeCreate() or SyncTypeCreate_r() kernel call directly; instead, use the POSIX functions for synchronization objects (see pthread_cond_init(), pthread_mutex_init(), pthread_rwlock_init(), and sem_init()). |
#include <sys/neutrino.h> int SyncTypeCreate( unsigned type, sync_t * sync, const struct _sync_attr * attr ); int SyncTypeCreate_r( unsigned type, sync_t * sync, const struct _sync_attr * attr );
If attr is NULL, the default attributes (PTHREAD_PRIO_INHERIT) are assumed.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The SyncTypeCreate() and SyncTypeCreate_r() kernel calls create a synchronization object in the kernel and initializes sync for use in other synchronization kernel calls. These functions are similar, except for the way they indicate errors. See the Returns section for details.
![]() |
You should allocate synchronization objects only in normal memory mappings. On certain processors (e.g. some PPC ones), atomic operations such as calls to pthread_mutex_lock() will cause a fault if the control structure is allocated in uncached memory. |
Synchronization objects can be used for mutexes, semaphores, or condition variables.
You can destroy the synchronization object by calling SyncDestroy().
These calls don't block.
The only difference between these functions is the way they indicate errors:
Or:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
pthread_cond_init(), pthread_mutex_init(), pthread_rwlock_init(), sem_init(), SyncCondvarSignal(), SyncCondvarWait(), SyncDestroy(), SyncMutexLock(), SyncMutexUnlock()
“Synchronization services” in the QNX Neutrino Microkernel chapter of the System Architecture guide
![]() |
![]() |
![]() |
![]() |