Update.
[glibc.git] / linuxthreads / spinlock.h
blob1707d3e42ae5c01e8afa2a2f5a25d1327f636d88
1 /* Linuxthreads - a simple clone()-based implementation of Posix */
2 /* threads for Linux. */
3 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) and */
4 /* Richard Henderson (rth@tamu.edu) */
5 /* */
6 /* This program is free software; you can redistribute it and/or */
7 /* modify it under the terms of the GNU Library General Public License */
8 /* as published by the Free Software Foundation; either version 2 */
9 /* of the License, or (at your option) any later version. */
10 /* */
11 /* This program is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU Library General Public License for more details. */
16 /* Spin locks */
18 extern void __pthread_acquire(int * spinlock);
20 static inline void acquire(int * spinlock)
22 if (testandset(spinlock)) __pthread_acquire(spinlock);
25 static inline void release(int * spinlock)
27 #ifndef RELEASE
28 *spinlock = 0;
29 #else
30 RELEASE(spinlock);
31 #endif