Destroy a synchronization object
#include <sys/neutrino.h> int SyncDestroy( sync_t* sync ); int SyncDestroy_r ( sync_t* sync );
- The synchronization object that you want to destroy.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The SyncDestroy() and SyncDestroy_r() kernel calls destroy a synchronization object previously allocated by a call to SyncTypeCreate(). If the object is a locked mutex, or a condition variable with waiting threads, the call fails. Any attempt to use sync after it is destroyed fails.
These functions are identical except in the way they indicate errors. See the Returns section for details.
These calls don't block.
The only difference between these functions is the way they indicate errors:
- If an error occurs, the function returns -1 and sets errno. Any other value returned indicates success.
- 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.
- The synchronization object is locked by a thread.
- A fault occurred when the kernel tried to access sync.
- The synchronization ID specified in sync doesn't exist.