aboutsummaryrefslogtreecommitdiffstats
path: root/include/c11
Commit message (Collapse)AuthorAgeFilesLines
* Require Visual Studio 2015.Jose Fonseca2018-09-101-11/+1
| | | | | | | | We no longer need or use Visual Studio 2013. https://ci.appveyor.com/project/jrfonseca/mesa/build/52 Reviewed-by: Roland Scheidegger <[email protected]>
* threads,configure.ac,meson.build: define and use HAVE_TIMESPEC_GETNicolai Hähnle2017-11-161-1/+1
| | | | | | | | | | | | | | | Tested with Travis and Appveyor. v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds v3: use check_functions in Scons (Eric) Cc: Rob Herring <[email protected]> Cc: Alexander von Gluck IV <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674 Fixes: f1a364878431 ("threads: update for late C11 changes") Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Jon Turney <[email protected]> (v2)
* c11/haiku: Define missing timespec_get on HaikuAlexander von Gluck IV2017-11-131-1/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* threads: fix MinGW build breakageBrian Paul2017-11-091-1/+4
| | | | | | Fixes: f1a364878431c8 ("threads: update for late C11 changes") Reviewed-by: Roland Scheidegger <[email protected]>
* threads: update for late C11 changesNicolai Hähnle2017-11-093-53/+47
| | | | | | | | | | | | | | | | | | | | C11 threads were changed to use struct timespec instead of xtime, and thrd_sleep got a second argument. See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1554.htm and http://en.cppreference.com/w/c/thread/{thrd_sleep,cnd_timedwait,mtx_timedlock} Note that cnd_timedwait is spec'd to be relative to TIME_UTC / CLOCK_REALTIME. v2: Fix Windows build errors. Tested with a default Appveyor config that uses Visual Studio 2013. Judging from Brian's email and random internet sources, Visual Studio 2015 does have timespec and timespec_get, hence the _MSC_VER-based guard which I have not tested. Cc: Jose Fonseca <[email protected]> Cc: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v1)
* c11/threads: rework Windows thrd_current() commentEmil Velikov2017-05-041-3/+7
| | | | | | | | | | | | Drop the misleading "will not match the one returned by thread_create" hunk and provide more clarity as to what/why GetCurrentThread() isn't the solution we're looking for. v2: Places brackets after function names (Eric) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> (v1) Reviewed-by: Eric Engestrom <[email protected]>
* c11/threads: Include thr/xtimec.h for xtime definition when building with MSVC.Jose Fonseca2017-03-291-0/+5
| | | | | | | | | | | | | | | | | | | MSVC has been including a xtime definition in thr/xtimec.h ever since MSVC 2013 (which is the minimum we require for building Mesa), and including it prevents duplicate definitions when it gets included by LLVM. In fact, it looks that MSVC has been including a partial C11 threads implementation too for some time, which we should consider migrating to once we eliminate the use of _MTX_INITIALIZER_NP in our tree. Thanks to the anonymous helper from https://bugs.freedesktop.org/show_bug.cgi?id=100201#c4 for spotting this. Reviewed-by: Roland Scheidegger <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100201 CC: "17.0" <[email protected]>
* Introduce .editorconfigEric Engestrom2016-08-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | A few weeks ago, Jose Fonseca suggested [0] we use .editorconfig files to try and enforce the formatting of the code, to which Michel Dänzer suggested [1] we start by importing the existing .dir-locals.el settings. The first draft was discussed in the RFC [2]. These .editorconfig are a first step, one that has the advantage of requiring little to no intervention from the devs once the settings files are in place, but the settings are very limited. This does have the advantage of applying while the code is being written. This doesn't replace the need for more comprehensive formatting tools such as clang-format & clang-tidy, but those reformat the code after the fact. [0] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121545.html [1] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121639.html [2] https://lists.freedesktop.org/archives/mesa-dev/2016-July/123431.html Acked-by: Nicolai Hähnle <[email protected]> Acked-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* Disable use of weak in threads_posix.h on CygwinJon Turney2016-07-151-1/+1
| | | | | | | | | Weak doesn't work the same on PE/COFF as on ELF, they are only weak references. Specifically, since nothing else pulls in the object which contains pthread_mutexattr_init() (and coming from the C library, that is the only thing that object contains), means that it ends up as 0 Signed-off-by: Jon Turney <[email protected]>
* c11/threads: resolve link issues with -O0Emil Velikov2016-05-241-0/+26
| | | | | | | | | | | | | | | | | | | Add weak symbol notation for the pthread_mutexattr* symbols, thus making the linker happy. When building with -O1 or greater the optimiser will kick in and remove the said functions as they are dead/unreachable code. Ideally we'll enable the optimisations locally, yet that does not seem to work atm. v2: Add the AX_GCC_FUNC_ATTRIBUTE([weak]) hunk in configure. Cc: Alejandro Piñeiro <[email protected]> Cc: Ben Widawsky <[email protected]> Cc: Ilia Mirkin <[email protected]> Cc: Rob Herring <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Clark <[email protected]> Tested-by: Mark Janes <[email protected]>
* c11/threads: create mutexattrs only when neededEmil Velikov2016-05-231-2/+7
| | | | | | | | If the mutexattrs are the default one can just pass NULL to pthread_mutex_init. As the compiler does not know this detail it unnecessarily creates/destroys the attrs. Signed-off-by: Emil Velikov <[email protected]>
* c11/threads: initialize timeout structureJan Vesely2015-10-081-0/+6
| | | | | Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* c11/threads: Assert that mtx is non-NULL and check return values.Matt Turner2015-09-251-25/+23
| | | | | | | | | | | | Passing NULL to C11 threads functions isn't safe, so there's no need for our implementation to handle it. Cuts about 1k of .text. text data bss dec hex filename 5009514 198440 26328 5234282 4fde6a i965_dri.so before 5008346 198440 26328 5233114 4fd9da i965_dri.so after Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* c11/threads: Use PTHREAD_MUTEX_RECURSIVE by defaultFelix Janda2015-03-161-6/+1
| | | | | | | | | | | | Previously PTHREAD_MUTEX_RECURSIVE_NP had been used on linux for compatibility with old glibc. Since mesa defines __GNU_SOURCE__ on linux PTHREAD_MUTEX_RECURSIVE is also available since at least 1998. So we can unconditionally use the portable version PTHREAD_MUTEX_RECURSIVE. Cc: "10.5" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88534 Reviewed-by: Emil Velikov <[email protected]>
* c11/threads: correct assertionEmil Velikov2014-08-121-1/+1
| | | | | | | | | | We should assert when either the function or the flag pointer is null or we'll end up with a null reference a few lines later. Currently unused by mesa thus it has gone unnoticed. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* c11/threads: don't include assert.h if the assert macro is already definedBrian Paul2014-03-192-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" <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* c11/threads: Don't implement thrd_current on Windows.José Fonseca2014-03-041-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" <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* c11/threads: Fix nano to milisecond conversion.José Fonseca2014-03-041-1/+1
| | | | | | | | Per https://gist.github.com/yohhoy/2223710/#comment-710118 Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
* c11: Add missing stdlib.h include.José Fonseca2014-01-281-0/+1
| | | | | | For malloc/free. Silences gcc mingw warnings.
* c11: Do not use pthread_mutex_timedlock on NetBSD.Vinson Lee2014-01-241-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 <[email protected]>
* c11: Fix missing pthread_mutex_timedlock declaration warnings on MacOSX.José Fonseca2014-01-231-1/+7
|
* c11: Update docs/license.html and include verbatim copy of Boost license.José Fonseca2014-01-233-3/+66
|
* c11: Import threads.h emulation library.José Fonseca2014-01-233-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 <[email protected]> Acked-by: Ian Romanick <[email protected]> Acked-by: Chad Versace <[email protected]>