Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2085
Line 40... Line 40...
40
#include <preemption.h>
40
#include <preemption.h>
41
#include <atomic.h>
41
#include <atomic.h>
42
#include <debug.h>
42
#include <debug.h>
43
 
43
 
44
#ifdef CONFIG_SMP
44
#ifdef CONFIG_SMP
45
struct spinlock {
45
typedef struct {
46
#ifdef CONFIG_DEBUG_SPINLOCK
46
#ifdef CONFIG_DEBUG_SPINLOCK
47
    char *name;
47
    char *name;
48
#endif
48
#endif
49
    atomic_t val;
49
    atomic_t val;
50
};
50
} spinlock_t;
51
 
51
 
52
/*
52
/*
53
 * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
53
 * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
54
 * where the lock gets initialized in run time.
54
 * where the lock gets initialized in run time.
55
 */
55
 */
Line 101... Line 101...
101
    preemption_enable();
101
    preemption_enable();
102
}
102
}
103
 
103
 
104
#else
104
#else
105
 
105
 
-
 
106
typedef void spinlock_t;
-
 
107
 
106
/* On UP systems, spinlocks are effectively left out. */
108
/* On UP systems, spinlocks are effectively left out. */
107
#define SPINLOCK_DECLARE(name)
109
#define SPINLOCK_DECLARE(name)
108
#define SPINLOCK_INITIALIZE(name)
110
#define SPINLOCK_INITIALIZE(name)
109
 
111
 
110
#define spinlock_initialize(x,name)
112
#define spinlock_initialize(x,name)