SyncTypeDestroy(), SyncTypeDestroy_r()

QNX SDP8.0C Library ReferenceAPIDeveloper

Destroy a synchronization object

CAUTION:
Don't use the SyncTypeDestroy() or SyncTypeDestroy_r() kernel call directly. Instead, use the POSIX functions for synchronization objects: pthread_cond_destroy(), pthread_mutex_destroy(), pthread_rwlock_destroy(), and sem_destroy().

Synopsis:

#include <sys/neutrino.h>

int SyncTypeDestroy( uint32_t type,
                     sync_t* sync );

int SyncTypeDestroy_r ( uint32_t type,
                        sync_t* sync );

Arguments:

type
The type of synchronization object. One of the following:
  • _NTO_SYNC_BARRIER — a barrier.
  • _NTO_SYNC_COND — a condition variable.
  • _NTO_SYNC_MUTEX_FREE — a mutex.
  • _NTO_SYNC_RWLOCK — a read-write lock.
  • _NTO_SYNC_SEM — an unnamed semaphore.
sync
The synchronization object that you want to destroy.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

SyncTypeDestroy() and SyncTypeDestroy_r() are internal kernel calls that destroy a synchronization object. If the object is a condition variable with waiting threads, the call fails. If you attempt to use sync after it is destroyed, this will fail.

These functions are identical except in the way they indicate errors; see the Returns section for details.

Blocking states

These calls don't block.

Returns:

The only difference between these functions is the way they indicate errors:

SyncTypeDestroy()
If an error occurs, the function returns -1 and sets errno. Any other value returned indicates success.
SyncTypeDestroy_r()
Returns EOK on success. This function does NOT set errno. If an error occurs, the function can return any value listed in the Errors section.

Errors:

EBUSY
The synchronization object is locked by a thread.
EFAULT
A fault occurred when the kernel tried to access sync.
EINVAL
One of the following occurred:
  • The synchronization ID specified in sync doesn't exist.
  • You didn't specify a valid type.
  • The object has already been destroyed.

Classification:

QNX OS

Safety:
Cancellation point No
Signal handler Yes
Thread Yes
Page updated: