nxt_spinlock.h (223:bf98efe2c55c) nxt_spinlock.h (765:7b63756a81a4)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UNIX_SPINLOCK_H_INCLUDED_
8#define _NXT_UNIX_SPINLOCK_H_INCLUDED_
9
10
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UNIX_SPINLOCK_H_INCLUDED_
8#define _NXT_UNIX_SPINLOCK_H_INCLUDED_
9
10
11#if (NXT_HAVE_MACOSX_SPINLOCK)
12
13#include <libkern/OSAtomic.h>
14
15typedef OSSpinLock nxt_thread_spinlock_t;
16
17#define \
18nxt_thread_spin_init(ncpu, count)
19
20#else
21
22typedef nxt_atomic_t nxt_thread_spinlock_t;
23
24NXT_EXPORT void nxt_thread_spin_init(nxt_uint_t ncpu, nxt_uint_t count);
11typedef nxt_atomic_t nxt_thread_spinlock_t;
12
13NXT_EXPORT void nxt_thread_spin_init(nxt_uint_t ncpu, nxt_uint_t count);
25
26#endif
27
28
29NXT_EXPORT void nxt_thread_spin_lock(nxt_thread_spinlock_t *lock);
30NXT_EXPORT nxt_bool_t nxt_thread_spin_trylock(nxt_thread_spinlock_t *lock);
31NXT_EXPORT void nxt_thread_spin_unlock(nxt_thread_spinlock_t *lock);
32
33
34#endif /* _NXT_UNIX_SPINLOCK_H_INCLUDED_ */
14NXT_EXPORT void nxt_thread_spin_lock(nxt_thread_spinlock_t *lock);
15NXT_EXPORT nxt_bool_t nxt_thread_spin_trylock(nxt_thread_spinlock_t *lock);
16NXT_EXPORT void nxt_thread_spin_unlock(nxt_thread_spinlock_t *lock);
17
18
19#endif /* _NXT_UNIX_SPINLOCK_H_INCLUDED_ */