1 | #ifndef XTHREAD_H_ |
1 | #ifndef XTHREAD_H_ |
2 | #define XTHREAD_H_ |
2 | #define XTHREAD_H_ |
3 | |
3 | |
4 | /* whether word reads are potentially non-atomic. |
4 | /* whether word reads are potentially non-atomic. |
5 | * this is conservatice, likely most arches this runs |
5 | * this is conservative, likely most arches this runs |
6 | * on have atomic word read/writes. |
6 | * on have atomic word read/writes. |
7 | */ |
7 | */ |
8 | #ifndef WORDACCESS_UNSAFE |
8 | #ifndef WORDACCESS_UNSAFE |
9 | # if __i386 || __x86_64 |
9 | # if __i386 || __x86_64 |
10 | # define WORDACCESS_UNSAFE 0 |
10 | # define WORDACCESS_UNSAFE 0 |
… | |
… | |
14 | #endif |
14 | #endif |
15 | |
15 | |
16 | ///////////////////////////////////////////////////////////////////////////// |
16 | ///////////////////////////////////////////////////////////////////////////// |
17 | |
17 | |
18 | #ifdef _WIN32 |
18 | #ifdef _WIN32 |
19 | typedef int ssize_t; |
|
|
20 | |
19 | |
21 | #define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls |
20 | #define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls |
22 | #define _WIN32_WINNT 0x400 |
21 | #define _WIN32_WINNT 0x400 |
23 | #include <stdio.h>//D |
22 | #include <stdio.h>//D |
24 | #include <fcntl.h> |
23 | #include <fcntl.h> |
… | |
… | |
128 | #ifndef PTHREAD_STACK_MIN |
127 | #ifndef PTHREAD_STACK_MIN |
129 | # define PTHREAD_STACK_MIN 0 |
128 | # define PTHREAD_STACK_MIN 0 |
130 | #endif |
129 | #endif |
131 | |
130 | |
132 | #ifndef X_STACKSIZE |
131 | #ifndef X_STACKSIZE |
133 | # define X_STACKSIZE sizeof (long) * 4096 |
132 | # define X_STACKSIZE sizeof (void *) * 4096 |
134 | #endif |
133 | #endif |
135 | |
134 | |
136 | static int |
135 | static int |
137 | thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) |
136 | thread_create (xthread_t *tid, void *(*proc)(void *), void *arg) |
138 | { |
137 | { |