sc/mutex/README.md

26 lines
334 B
Markdown
Raw Normal View History

2021-02-07 22:31:04 +03:00
### Mutex
2020-12-28 02:52:22 +03:00
### 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-06 21:36:18 +03:00
sc_mutex_init(&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-06 21:36:18 +03:00
sc_mutex_term(&mutex); // destroy mutex
2020-12-28 02:52:22 +03:00
return 0;
}
```