diff options
| author | Brent Cook <busterb@gmail.com> | 2018-11-11 11:00:00 -0600 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2018-11-11 11:00:00 -0600 |
| commit | 387d2ae261c64396036a1c53e303364b03444257 (patch) | |
| tree | 496c0cca183a064ffd005c81d96e55b927845eae /include | |
| parent | ff7a18318c3e6686df1d31c390ecc7fe5bc9f23e (diff) | |
| download | portable-387d2ae261c64396036a1c53e303364b03444257.tar.gz portable-387d2ae261c64396036a1c53e303364b03444257.tar.bz2 portable-387d2ae261c64396036a1c53e303364b03444257.zip | |
change windows compatibility stubs for pthread_t to be more like other OSes
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/pthread.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/include/compat/pthread.h b/include/compat/pthread.h index b2db760..861c8e1 100644 --- a/include/compat/pthread.h +++ b/include/compat/pthread.h | |||
| @@ -38,23 +38,18 @@ pthread_once(pthread_once_t *once, void (*cb) (void)) | |||
| 38 | return 0; | 38 | return 0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | struct pthread { | 41 | typedef DWORD pthread_t; |
| 42 | HANDLE handle; | ||
| 43 | }; | ||
| 44 | typedef struct pthread pthread_t; | ||
| 45 | 42 | ||
| 46 | static inline pthread_t | 43 | static inline pthread_t |
| 47 | pthread_self(void) | 44 | pthread_self(void) |
| 48 | { | 45 | { |
| 49 | pthread_t self; | 46 | return GetCurrentThreadId(); |
| 50 | self.handle = GetCurrentThread(); | ||
| 51 | return self; | ||
| 52 | } | 47 | } |
| 53 | 48 | ||
| 54 | static inline int | 49 | static inline int |
| 55 | pthread_equal(pthread_t t1, pthread_t t2) | 50 | pthread_equal(pthread_t t1, pthread_t t2) |
| 56 | { | 51 | { |
| 57 | return t1.handle == t2.handle; | 52 | return t1 == t2; |
| 58 | } | 53 | } |
| 59 | 54 | ||
| 60 | #else | 55 | #else |
