summaryrefslogtreecommitdiff
path: root/include/c11
AgeCommit message (Collapse)AuthorFilesLines
2014-03-19c11/threads: don't include assert.h if the assert macro is already definedBrian Paul2-0/+4
In the gallium code, the assert() macro could come from either the system's assert.h file (via c11/threads.h) or from gallium's u_debug.h. It looks like all known assert.h files unconditionally #undef assert before defining their own version. So the assert you get depends on whether threads.h or u_debug.h was included last. In the gallium code we really want to use the assert() from u_debug.h (it behaves better on Windows). In gallium, c11/threads.h is only included after u_debug.h in the os_thread.h wrapper. So Adding an #ifndef assert test in the threads*.h files avoids using the system's assert(). Cc: "10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: José Fonseca <jfonseca@vmware.com>
2014-03-04c11/threads: Don't implement thrd_current on Windows.José Fonseca1-2/+32
GetCurrentThread() returns a pseudo-handle (a constant which only makes sense when used within the calling thread) and not a real handle. DuplicateHandle() will return a real handle, but it will create a new handle every time we call. Calling DuplicateHandle() here means we will leak handles, which can cause serious problems. In short, the Windows implementation of thrd_t needs a thorough make over, and it won't be pretty. It looks like C11 committee over-simplified things: it would be much better to have seperate objects for threads and thread IDs like C++11 does. For now, just comment out the thrd_current() implementation, so we get build errors if anybody tries to use it. Thanks to Brian Paul for spotting and diagnosing this problem. Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
2014-03-04c11/threads: Fix nano to milisecond conversion.José Fonseca1-1/+1
Per https://gist.github.com/yohhoy/2223710/#comment-710118 Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Michel Dänzer <michel@daenzer.net>
2014-01-28c11: Add missing stdlib.h include.José Fonseca1-0/+1
For malloc/free. Silences gcc mingw warnings.
2014-01-24c11: Do not use pthread_mutex_timedlock on NetBSD.Vinson Lee1-1/+1
This patch fixes the NetBSD build. NetBSD does not have pthread_mutex_timedlock. CC glapi_dispatch.lo threads_posix.h: In function 'mtx_timedlock': threads_posix.h:216:5: error: implicit declaration of function 'pthread_mutex_timedlock' Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2014-01-23c11: Fix missing pthread_mutex_timedlock declaration warnings on MacOSX.José Fonseca1-1/+7
2014-01-23c11: Update docs/license.html and include verbatim copy of Boost license.José Fonseca3-3/+66
2014-01-23c11: Import threads.h emulation library.José Fonseca3-0/+992
Implementation is based of https://gist.github.com/2223710 with the following modifications: - inline implementatation - retain XP compatability - add temporary hack for static mutex initializers (as they are not part of the stack but still widely used internally) - make TIME_UTC a conditional macro (some system headers already define it, so this prevents conflict) - respect HAVE_PTHREAD macro Reviewed-by: Brian Paul <brianp@vmware.com> Acked-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Chad Versace <chad.versace@linux.intel.com>