src/thread-utils.h


Log

Author Commit Date CI Message
Ramsay Jones 3e0fb8fb 2009-06-04T17:12:59 thread-utils.h: Avoid using a non-standard C construct In particular, in standard C, a struct or union must have at least one member declared (ie. structs and unions cannot be empty). Some compilers allow empty structs as an extension and won't even issue a warning unless asked for it (eg, gcc requires -pedantic). Some compilers allow empty structs as an extension and will only treat it as an error if asked for strict checking (eg Digital-Mars with -A). Some compilers simply treat it as an error (eg MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Shawn O. Pearce 51eb2f90 2009-01-02T21:48:40 Change the use of asm/atomic.h to require -DGIT_HAS_ASM_ATOMIC These headers aren't always available; they typically come from the Linux kernel, but aren't supposed to be exported into the userspace /usr/include. Modern kernels won't install these and some distros rm -rf the directory post kernel header install. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 11bb049b 2009-01-02T21:41:52 Fix pthread_mutex based gitrc_dec The function should return true only when the counter drops to 0. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 028ef0de 2008-12-31T13:20:21 Add a mutex and atomic counter abstraction and implementations These abstractions can be used to implement an efficient resource reference counter and simple mutual exclusion. On pthreads we use pthread_mutex_t, except when we are also on glibc and can directly use its asm/atomic.h definitions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Andreas Ericsson 36f0f61f 2008-11-18T19:06:25 Add compiler/platform agnostic thread-local storage It doesn't cover all cases, but we can work on those as we go along. For now, gcc, MSVC++, Intel C/C++, IBM XL C/C++, Sun Studio C/C++ and Borland C++ Builder are the supported compilers (although we boldly assume that they all are of a recent enough version to support thread-local storage). This is intended to be used in upcoming patches that implement graceful (but TLS-dependant) error-handling in the library. As an added bonus, we also bring the online_cpus() function from git.git to detect the number of usable cpu's. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>