Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
854 serge 1
 
2
3
 
4
5
 
6
{
7
	atomic_t val;
8
} spinlock_t;
9
10
 
11
 * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
12
 * where the lock gets initialized in run time.
13
 */
14
15
 
16
17
 
18
 * SPINLOCK_INITIALIZE is to be used for statically allocated spinlocks.
19
 * It declares and initializes the lock.
20
 */
21
22
 
23
	spinlock_t slname = { 		\
24
		.val = { 0 }		\
25
	}
26
27
 
28
extern int spinlock_trylock(spinlock_t *sl);
29
30
 
31
32
 
33
 *
34
 * Unlock spinlock.
35
 *
36
 * @param sl Pointer to spinlock_t structure.
37
 */
38
static inline void spinlock_unlock(spinlock_t *sl)
39
{
40
  ASSERT(atomic_get(&sl->val) != 0);
41
42
 
43
	 * Prevent critical section code from bleeding out this way down.
44
	 */
45
 // CS_LEAVE_BARRIER();
46
47
 
48
//  preemption_enable();
49
}
50
51
 
52
53
 
54
#define SPINLOCK_DECLARE(name)
55
#define SPINLOCK_EXTERN(name)
56
#define SPINLOCK_INITIALIZE(name)
57
58
 
59
#define spinlock_lock(x)
60
#define spinlock_trylock(x)
61
#define spinlock_unlock(x)
62
63
 
64