Debian Codegraph @

rpython/translator/c/src/thread.h

raw symbols SCIP
1 #ifndef __PYPY_THREAD_H
2 #define __PYPY_THREAD_H
3 #include "precommondefs.h"
4 #include <assert.h>
5
6 #define RPY_TIMEOUT_T long long
7
8 typedef enum RPyLockStatus {
9 RPY_LOCK_FAILURE = 0,
10 RPY_LOCK_ACQUIRED = 1,
11 RPY_LOCK_INTR = 2
12 } RPyLockStatus;
13
14 #ifdef _WIN32
15 #define RPYTHREAD_NAME "win7"
16 #include "thread_win7.h"
17 #else
18
19 /* We should check if unistd.h defines _POSIX_THREADS, but sometimes
20 it is not defined even though the system implements them as an
21 external library (e.g. gnu pth in pthread emulation). So we just
22 always go ahead and use them, assuming they are supported on all
23 platforms for which we care. If not, do some detecting again.
24 */
25 #define RPYTHREAD_NAME "pthread"
26 #include "thread_pthread.h"
27
28 #endif /* !_WIN32 */
29
30 RPY_EXTERN void RPyGilAllocate(void);
31 RPY_EXTERN Signed RPyGilYieldThread(void);
32 RPY_EXTERN void RPyGilReleaseSignal(void);
33 RPY_EXTERN void RPyGilAcquireSlowPath(void);
34 RPY_EXTERN unsigned long RPyThread_get_thread_native_id(void);
35 #define RPyGilAcquire _RPyGilAcquire
36 #define RPyGilRelease _RPyGilRelease
37 #define RPyFetchFastGil _RPyFetchFastGil
38 #define RPyGilGetHolder _RPyGilGetHolder
39 #define RPY_FASTGIL_LOCKED(x) (x != 0)
40
41 RPY_EXTERN Signed rpy_fastgil;
42
43 #endif