Last change
on this file since 1f922f4 was
d4da6886,
checked in by Thierry Delisle <tdelisle@…>, 4 years ago
|
Some renaming to move away from dlopen in toy program
|
-
Property mode set to
100644
|
File size:
840 bytes
|
Line | |
---|
1 | #include <cassert> |
---|
2 | #include <clib/cfathread.h> |
---|
3 | |
---|
4 | typedef cfathread_t thread_t; |
---|
5 | static_assert(sizeof(thread_t) == sizeof(void*), "thread_t musst be of same size as void*"); |
---|
6 | |
---|
7 | #if !defined(__cplusplus) |
---|
8 | #error no __cplusplus define! |
---|
9 | #endif |
---|
10 | |
---|
11 | extern "C" { |
---|
12 | //-------------------- |
---|
13 | // Basic thread support |
---|
14 | thread_t thrdlib_create( void (*the_main)( thread_t ) ) { |
---|
15 | return cfathread_create( the_main ); |
---|
16 | } |
---|
17 | |
---|
18 | void thrdlib_join( thread_t handle ) { |
---|
19 | cfathread_join( handle ); |
---|
20 | } |
---|
21 | |
---|
22 | void thrdlib_park( thread_t ) { |
---|
23 | cfathread_park(); |
---|
24 | } |
---|
25 | |
---|
26 | void thrdlib_unpark( thread_t handle ) { |
---|
27 | cfathread_unpark( handle ); |
---|
28 | } |
---|
29 | |
---|
30 | void thrdlib_yield( void ) { |
---|
31 | cfathread_yield(); |
---|
32 | } |
---|
33 | |
---|
34 | //-------------------- |
---|
35 | // Basic kernel features |
---|
36 | void thrdlib_init( int procs ) { |
---|
37 | cfathread_setproccnt(procs); |
---|
38 | } |
---|
39 | |
---|
40 | void thrdlib_clean( void ) { |
---|
41 | cfathread_setproccnt(1); |
---|
42 | } |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.