ObjFW  Diff

Differences From Artifact [ec6d801a5e]:

To Artifact [bf0ea6d5c4]:


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
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







-
+




-
+






-
+







#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>
# 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>
# 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"
# 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
245

246
247
248
249
250
251
252
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)
	*s = 0;
	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
}