mirror of
https://github.com/tezc/sc.git
synced 2025-01-28 07:03:06 +08:00
33 lines
392 B
Markdown
33 lines
392 B
Markdown
|
# Thread
|
||
|
|
||
|
#### Overview
|
||
|
|
||
|
- Thread wrapper for Unixes and Windows
|
||
|
|
||
|
|
||
|
##### Usage
|
||
|
|
||
|
|
||
|
```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;
|
||
|
}
|
||
|
|
||
|
```
|