2021-02-07 22:31:04 +03:00
|
|
|
### Thread
|
2021-02-03 08:09:50 +03:00
|
|
|
|
2021-02-07 22:31:04 +03:00
|
|
|
### Overview
|
2021-02-03 08:09:50 +03:00
|
|
|
|
2021-02-06 10:19:31 +03:00
|
|
|
- Thread wrapper for Posix and Windows
|
2021-02-03 08:09:50 +03:00
|
|
|
|
2021-02-07 22:31:04 +03:00
|
|
|
### Usage
|
2021-02-03 08:09:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
```c
|
|
|
|
|
|
|
|
#include "sc_thread.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
void* fn(void* arg)
|
|
|
|
{
|
|
|
|
printf("%s \n", (char*) arg);
|
|
|
|
return arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
struct sc_thread thread;
|
|
|
|
|
|
|
|
sc_thread_init(&thread);
|
|
|
|
sc_thread_start(&thread, fn, "first");
|
|
|
|
sc_thread_term(&thread);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|