Design Pattern Examples
Overview of object-oriented design patterns
mutex.h
Go to the documentation of this file.
1
5#pragma once
6#ifndef __MUTEX_H__
7#define __MUTEX_H__
8
9#include <stdbool.h>
10
15typedef struct
16{
17
21 void* handle;
22} Mutex;
23
30bool mutex_create(Mutex* mutex);
31
38bool mutex_destroy(Mutex* mutex);
39
47bool mutex_lock(Mutex* mutex);
48
55bool mutex_unlock(Mutex* mutex);
56
57
58#endif // __MUTEX_H__
59
bool mutex_destroy(Mutex *mutex)
Destroy a previously created mutex.
Definition: mutex.c:128
bool mutex_unlock(Mutex *mutex)
Unlock a previously locked mutex.
Definition: mutex.c:197
bool mutex_create(Mutex *mutex)
Create a new mutex, which is initially not owned.
Definition: mutex.c:71
bool mutex_lock(Mutex *mutex)
Lock a previously created and unlocked mutex. This will block if the mutex is already locked by some ...
Definition: mutex.c:160
Represents a handle to a mutex. Call mutex_create() to create the mutex and mutex_destroy() to destro...
Definition: mutex.h:16
void * handle
An opaque value that represents the operating system-specific mutex.
Definition: mutex.h:21