aboutsummaryrefslogtreecommitdiff
path: root/mesalib/include/c11
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
committermarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
commit3dd4b6420f686b0147d5b8136268cc63196e253b (patch)
tree2c81c3f7503dbcfb5b64fd95b40bb1c2204598ef /mesalib/include/c11
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.gz
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.bz2
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.zip
fontconfig mesa xserver git update 9 Mar 2014
xserver commit 1c61d38528a573caadee2468ee59ea558c822e09 fontconfig commit f8ccf379eb1092592ae0b65deb563c5491f69de9 mesa commit 897f40f25d21af678b1b67c1a68c4a6722d19983
Diffstat (limited to 'mesalib/include/c11')
-rw-r--r--mesalib/include/c11/threads_win32.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/mesalib/include/c11/threads_win32.h b/mesalib/include/c11/threads_win32.h
index be1a38957..d4c2a72d2 100644
--- a/mesalib/include/c11/threads_win32.h
+++ b/mesalib/include/c11/threads_win32.h
@@ -146,7 +146,7 @@ static unsigned __stdcall impl_thrd_routine(void *p)
static DWORD impl_xtime2msec(const xtime *xt)
{
- return (DWORD)((xt->sec * 1000u) + (xt->nsec / 1000));
+ return (DWORD)((xt->sec * 1000U) + (xt->nsec / 1000000L));
}
#ifdef EMULATED_THREADS_USE_NATIVE_CALL_ONCE
@@ -492,12 +492,42 @@ thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
return thrd_success;
}
+#if 0
// 7.25.5.2
static inline thrd_t
thrd_current(void)
{
- return GetCurrentThread();
+ HANDLE hCurrentThread;
+ BOOL bRet;
+
+ /* GetCurrentThread() returns a pseudo-handle, which is useless. We need
+ * to call DuplicateHandle to get a real handle. However the handle value
+ * will not match the one returned by thread_create.
+ *
+ * Other potential solutions would be:
+ * - define thrd_t as a thread Ids, but this would mean we'd need to OpenThread for many operations
+ * - use malloc'ed memory for thrd_t. This would imply using TLS for current thread.
+ *
+ * Neither is particularly nice.
+ *
+ * Life would be much easier if C11 threads had different abstractions for
+ * threads and thread IDs, just like C++11 threads does...
+ */
+
+ bRet = DuplicateHandle(GetCurrentProcess(), // source process (pseudo) handle
+ GetCurrentThread(), // source (pseudo) handle
+ GetCurrentProcess(), // target process
+ &hCurrentThread, // target handle
+ 0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS);
+ assert(bRet);
+ if (!bRet) {
+ hCurrentThread = GetCurrentThread();
+ }
+ return hCurrentThread;
}
+#endif
// 7.25.5.3
static inline int
@@ -511,7 +541,7 @@ thrd_detach(thrd_t thr)
static inline int
thrd_equal(thrd_t thr0, thrd_t thr1)
{
- return (thr0 == thr1);
+ return GetThreadId(thr0) == GetThreadId(thr1);
}
// 7.25.5.5