Line | |
---|
1 | /* -*- mode: C; tab-width:8; c-basic-offset:8 -*- |
---|
2 | * vi:set ts=8: |
---|
3 | * |
---|
4 | * al_threadlib.h |
---|
5 | * |
---|
6 | * Header which sorts out which thread package we're using. |
---|
7 | */ |
---|
8 | #ifndef THREADLIB_H_ |
---|
9 | #define THREADLIB_H_ |
---|
10 | |
---|
11 | #include "al_siteconfig.h" |
---|
12 | |
---|
13 | #if defined(USE_POSIXTHREADING) |
---|
14 | |
---|
15 | #include <pthread.h> |
---|
16 | typedef pthread_t *ThreadID; |
---|
17 | |
---|
18 | #elif defined(USE_WINDOWSTHREADING) |
---|
19 | |
---|
20 | #include <windows.h> |
---|
21 | typedef HANDLE ThreadID; |
---|
22 | |
---|
23 | #elif defined(USE_MORPHOSTHREADING) |
---|
24 | |
---|
25 | #include <exec/ports.h> |
---|
26 | #include <dos/dosextens.h> |
---|
27 | |
---|
28 | struct ThreadData { |
---|
29 | struct Process *td_Thread; |
---|
30 | struct MsgPort *td_MsgPort; |
---|
31 | }; |
---|
32 | |
---|
33 | typedef struct ThreadData *ThreadID; |
---|
34 | |
---|
35 | #else |
---|
36 | |
---|
37 | #error "No thread package" |
---|
38 | |
---|
39 | #endif |
---|
40 | |
---|
41 | /* |
---|
42 | * Creates a thread, which starts by running fn. |
---|
43 | */ |
---|
44 | extern ThreadID _alCreateThread( int ( *fn ) ( void * ) ); |
---|
45 | |
---|
46 | /* |
---|
47 | * Waits for thread to terminate before returning. |
---|
48 | */ |
---|
49 | extern int _alWaitThread( ThreadID thread ); |
---|
50 | |
---|
51 | /* |
---|
52 | * Returns the identifier for the callee's thread. |
---|
53 | */ |
---|
54 | extern unsigned int _alSelfThread( void ); |
---|
55 | |
---|
56 | /* |
---|
57 | * Forces the callee to terminate. |
---|
58 | */ |
---|
59 | extern void _alExitThread( void ) AL_ATTRIBUTE_NORETURN_; |
---|
60 | |
---|
61 | #endif /* THREADLIB_H_ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.