28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# import "threading.h"
# define NUM_SPINLOCKS 8 /* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1))
static of_spinlock_t spinlocks[NUM_SPINLOCKS];
#endif
#ifdef OF_HAVE_THREADS
static void __attribute__((constructor))
init(void)
{
size_t i;
for (i = 0; i < NUM_SPINLOCKS; i++)
if (!of_spinlock_new(&spinlocks[i]))
OBJC_ERROR("Failed to initialize spinlocks!")
|
|
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# import "threading.h"
# define NUM_SPINLOCKS 8 /* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1))
static of_spinlock_t spinlocks[NUM_SPINLOCKS];
#endif
#ifdef OF_HAVE_THREADS
static void __attribute__((__constructor__))
init(void)
{
size_t i;
for (i = 0; i < NUM_SPINLOCKS; i++)
if (!of_spinlock_new(&spinlocks[i]))
OBJC_ERROR("Failed to initialize spinlocks!")
|