OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / bionic / libc / kernel / arch-arm / asm / semaphore.h
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef __ASM_ARM_SEMAPHORE_H
13 #define __ASM_ARM_SEMAPHORE_H
14
15 #include <linux/linkage.h>
16 #include <linux/spinlock.h>
17 #include <linux/wait.h>
18 #include <linux/rwsem.h>
19
20 #include <asm/atomic.h>
21 #include <asm/locks.h>
22
23 struct semaphore {
24  atomic_t count;
25  int sleepers;
26  wait_queue_head_t wait;
27 };
28
29 #define __SEMAPHORE_INIT(name, cnt)  {   .count = ATOMIC_INIT(cnt),   .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait),  }
30
31 #define __DECLARE_SEMAPHORE_GENERIC(name,count)   struct semaphore name = __SEMAPHORE_INIT(name,count)
32
33 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
34 #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
35
36 #endif