diff options
author | Brian Paul <[email protected]> | 2015-03-04 19:17:57 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-03-05 06:59:43 -0700 |
commit | 458c7490c29ef2960a33a089f65490e044da5d27 (patch) | |
tree | ed6a48f2a292815dc2fa17e2925aa5149f23ab1c /src/mapi/u_thread.h | |
parent | 6b5eb7bce6ac5351b0c96252a1c8738f51834e1d (diff) |
mapi: rewrite u_current_init() function without u_thread_self()
Remove u_thread_self() since u_thread.h is going away soon.
Create a simple thread ID abstraction which wraps WIN32 or c11 threads.
This also gets rid of the questionable casting of thrd_t to an unsigned
long.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mapi/u_thread.h')
-rw-r--r-- | src/mapi/u_thread.h | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h index 4dd95150d3f..e57c69a2430 100644 --- a/src/mapi/u_thread.h +++ b/src/mapi/u_thread.h @@ -80,30 +80,6 @@ struct u_tsd { }; -static inline unsigned long -u_thread_self(void) -{ - /* - * XXX: Callers of u_thread_self assume it is a lightweight function, - * returning a numeric value. But unfortunately C11's thrd_current() gives - * no such guarantees. In fact, it's pretty hard to have a compliant - * implementation of thrd_current() on Windows with such characteristics. - * So for now, we side-step this mess and use Windows thread primitives - * directly here. - * - * FIXME: On the other hand, u_thread_self() is a bad - * abstraction. Even with pthreads, there is no guarantee that - * pthread_self() will return numeric IDs -- we should be using - * pthread_equal() instead of assuming we can compare thread ids... - */ -#ifdef _WIN32 - return GetCurrentThreadId(); -#else - return (unsigned long) (uintptr_t) thrd_current(); -#endif -} - - static inline void u_tsd_init(struct u_tsd *tsd) { |