Differences From Artifact [ec6d801a5e]:
- File src/threading.h — part of check-in [35f59c61c6] at 2010-01-30 14:14:11 on branch trunk — Fix missing includes and typos. (user: js, size: 5526) [annotate] [blame] [check-ins using]
To Artifact [0b6953b2d5]:
- File
src/threading.h
— part of check-in
[b91a8283fe]
at
2010-03-05 11:52:18
on branch 0.2
— Merge a few changesets from the default branch into the 0.2 branch.
Changesets:
* b95fcaa6d694
* 804c68d222b4
* da8cd738da3d
* 1109d5ce3419
* d03f5c1ca95d
* 2a7017722165
* 4fccdc79eeb7
* d228149fbc04
* 8782d412a4a6 (user: js, size: 5555) [annotate] [blame] [check-ins using]
1 | /* | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * Copyright (c) 2008 - 2010 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFMacros.h" #if !defined(OF_THREADS) || (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32)) # error No threads available! #endif #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_t of_thread_t; typedef pthread_mutex_t of_mutex_t; typedef pthread_key_t of_tlskey_t; #elif defined(_WIN32) # include <windows.h> typedef HANDLE of_thread_t; typedef CRITICAL_SECTION of_mutex_t; typedef DWORD of_tlskey_t; #endif #if defined(OF_ATOMIC_OPS) # import "atomic.h" typedef int32_t of_spinlock_t; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) typedef pthread_spinlock_t of_spinlock_t; #else typedef pthread_mutex_t of_spinlock_t; #endif |
︙ | ︙ | |||
238 239 240 241 242 243 244 | #endif } static OF_INLINE BOOL of_spinlock_unlock(of_spinlock_t *s) { #if defined(OF_ATOMIC_OPS) | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | #endif } static OF_INLINE BOOL of_spinlock_unlock(of_spinlock_t *s) { #if defined(OF_ATOMIC_OPS) of_atomic_and32((uint32_t*)s, 0); return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return (pthread_spin_unlock(s) ? NO : YES); #else return of_mutex_unlock(s); #endif } |
︙ | ︙ |