MutexCreate
Description
Create a platform-independent mutex object. The mutex itself does not own an allocator - the caller is responsible for remembering alloc and passing it back to MutexDestroy so the handle’s one-shot allocation can be released through the same allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
alloc |
in | Allocator used to allocate the mutex handle. |
Success
Returns valid Mutex object.
Failure
Returns NULL if mutex creation fails.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Mutex.c:30:
};
Mutex *MutexCreate(Allocator *alloc) {
if (!alloc) {
LOG_FATAL("MutexCreate requires an allocator");- In
Mutex.c:32:
Mutex *MutexCreate(Allocator *alloc) {
if (!alloc) {
LOG_FATAL("MutexCreate requires an allocator");
}
Mutex *m = (Mutex *)AllocatorAlloc(alloc, sizeof(Mutex), true);- In
Log.c:122:
if (!log_mutex && log_persistent_alloc) {
log_mutex = MutexCreate(log_persistent_alloc);
if (log_mutex) {
atexit(free_log_mutex);
Last updated on