Commit Graph

5 Commits

Author SHA1 Message Date
Brian Paul eaf9affa5e c11/threads: don't include assert.h if the assert macro is already defined
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-19 17:13:31 -06:00
Vinson Lee a487b4d0e3 c11: Do not use pthread_mutex_timedlock on NetBSD.
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-24 18:20:42 -08:00
José Fonseca cd978ce26a c11: Fix missing pthread_mutex_timedlock declaration warnings on MacOSX. 2014-01-23 13:42:38 +00:00
José Fonseca 799f30f385 c11: Update docs/license.html and include verbatim copy of Boost license. 2014-01-23 12:55:55 +00:00
José Fonseca ecaa81bd96 c11: Import threads.h emulation library.
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>
2014-01-23 12:55:55 +00:00