Subversion Repositories HelenOS

Rev

Rev 2089 | Rev 2183 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2089 Rev 2093
Line 51... Line 51...
51
/*
51
/*
52
 * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
52
 * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
53
 * where the lock gets initialized in run time.
53
 * where the lock gets initialized in run time.
54
 */
54
 */
55
#define SPINLOCK_DECLARE(slname)    spinlock_t slname
55
#define SPINLOCK_DECLARE(slname)    spinlock_t slname
-
 
56
#define SPINLOCK_EXTERN(slname)     extern spinlock_t slname
56
 
57
 
57
/*
58
/*
58
 * SPINLOCK_INITIALIZE is to be used for statically allocated spinlocks.
59
 * SPINLOCK_INITIALIZE is to be used for statically allocated spinlocks.
59
 * It declares and initializes the lock.
60
 * It declares and initializes the lock.
60
 */
61
 */
Line 100... Line 101...
100
    preemption_enable();
101
    preemption_enable();
101
}
102
}
102
 
103
 
103
#else
104
#else
104
 
105
 
105
typedef void spinlock_t;
-
 
106
 
-
 
107
/* On UP systems, spinlocks are effectively left out. */
106
/* On UP systems, spinlocks are effectively left out. */
108
#define SPINLOCK_DECLARE(name)
107
#define SPINLOCK_DECLARE(name)
-
 
108
#define SPINLOCK_EXTERN(name)
109
#define SPINLOCK_INITIALIZE(name)
109
#define SPINLOCK_INITIALIZE(name)
110
 
110
 
111
#define spinlock_initialize(x, name)
111
#define spinlock_initialize(x, name)
112
#define spinlock_lock(x)        preemption_disable()
112
#define spinlock_lock(x)        preemption_disable()
113
#define spinlock_trylock(x)         (preemption_disable(), 1)
113
#define spinlock_trylock(x)         (preemption_disable(), 1)