2020-12-28 02:52:22 +03:00
|
|
|
# Mutex
|
|
|
|
|
|
|
|
### Mutex wrapper
|
|
|
|
|
2021-02-06 10:19:31 +03:00
|
|
|
- Basic mutex wrapper for Posix and Windows.
|
2020-12-28 02:52:22 +03:00
|
|
|
|
|
|
|
```c
|
|
|
|
|
2021-02-03 08:09:50 +03:00
|
|
|
#include "sc_mutex.h"
|
2020-12-28 02:52:22 +03:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2021-02-03 08:09:50 +03:00
|
|
|
struct sc_mutex mutex;
|
2020-12-28 02:52:22 +03:00
|
|
|
|
2021-02-03 08:09:50 +03:00
|
|
|
sc_mutex_init(&mutex);
|
2020-12-28 02:52:22 +03:00
|
|
|
|
2021-02-03 08:09:50 +03:00
|
|
|
sc_mutex_lock(&mutex);
|
|
|
|
sc_mutex_unlock(&mutex);
|
2020-12-28 02:52:22 +03:00
|
|
|
|
2021-02-03 08:09:50 +03:00
|
|
|
sc_mutex_term(&mutex);
|
2020-12-28 02:52:22 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|