1 | /* |
---|
2 | * This file is part of libtrace |
---|
3 | * |
---|
4 | * Copyright (c) 2007-2015 The University of Waikato, Hamilton, |
---|
5 | * New Zealand. |
---|
6 | * |
---|
7 | * Authors: Richard Sanger |
---|
8 | * |
---|
9 | * All rights reserved. |
---|
10 | * |
---|
11 | * This code has been developed by the University of Waikato WAND |
---|
12 | * research group. For further information please see http://www.wand.net.nz/ |
---|
13 | * |
---|
14 | * libtrace is free software; you can redistribute it and/or modify |
---|
15 | * it under the terms of the GNU General Public License as published by |
---|
16 | * the Free Software Foundation; either version 2 of the License, or |
---|
17 | * (at your option) any later version. |
---|
18 | * |
---|
19 | * libtrace is distributed in the hope that it will be useful, |
---|
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
22 | * GNU General Public License for more details. |
---|
23 | * |
---|
24 | * You should have received a copy of the GNU General Public License |
---|
25 | * along with libtrace; if not, write to the Free Software |
---|
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
27 | * |
---|
28 | * $Id$ |
---|
29 | * |
---|
30 | */ |
---|
31 | |
---|
32 | /** Apple does not implement pthread_spinlock_t so we'll do it for them */ |
---|
33 | |
---|
34 | #ifndef LIBTRACE_PTHREAD_SPINLOCK_H |
---|
35 | #define LIBTRACE_PTHREAD_SPINLOCK_H |
---|
36 | |
---|
37 | |
---|
38 | /* Apple does not implement pthread_spinlock_t |
---|
39 | */ |
---|
40 | |
---|
41 | #ifndef __PTHREAD_SPINLOCK_H |
---|
42 | #define __PTHREAD_SPINLOCK_H |
---|
43 | |
---|
44 | #ifdef __APPLE__ |
---|
45 | |
---|
46 | #include <libkern/OSAtomic.h> |
---|
47 | #include <errno.h> |
---|
48 | |
---|
49 | typedef OSSpinLock pthread_spinlock_t; |
---|
50 | |
---|
51 | int pthread_spin_lock(pthread_spinlock_t *lock); |
---|
52 | int pthread_spin_trylock(pthread_spinlock_t *lock); |
---|
53 | int pthread_spin_unlock(pthread_spinlock_t *lock); |
---|
54 | int pthread_spin_destroy(pthread_spinlock_t *lock); |
---|
55 | int pthread_spin_init(pthread_spinlock_t *lock, int pshared); |
---|
56 | |
---|
57 | #endif /* __APPLE__ */ |
---|
58 | #endif /* __PTHREAD_SPINLOCK_H */ |
---|
59 | |
---|
60 | |
---|
61 | #endif // LIBTRACE_PTHREAD_SPINLOCK_H |
---|