Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/spinlock.h

    rb2fa1204 r63e27ef  
    3636#define KERN_SPINLOCK_H_
    3737
    38 #include <typedefs.h>
     38#include <stdbool.h>
    3939#include <arch/barrier.h>
     40#include <assert.h>
    4041#include <preemption.h>
    4142#include <atomic.h>
    42 #include <debug.h>
    4343#include <arch/asm.h>
    4444
    4545#ifdef CONFIG_SMP
    4646
    47 typedef struct {
     47typedef struct spinlock {
    4848        atomic_t val;
    4949       
     
    8080
    8181#define ASSERT_SPINLOCK(expr, lock) \
    82         ASSERT_VERBOSE(expr, (lock)->name)
     82        assert_verbose(expr, (lock)->name)
    8383
    8484#define spinlock_lock(lock)    spinlock_lock_debug((lock))
     
    9898
    9999#define ASSERT_SPINLOCK(expr, lock) \
    100         ASSERT(expr)
     100        assert(expr)
    101101
    102102#define spinlock_lock(lock)    atomic_lock_arch(&(lock)->val)
     
    163163/* On UP systems, spinlocks are effectively left out. */
    164164
     165/* Allow the use of spinlock_t as an incomplete type. */
     166typedef struct spinlock spinlock_t;
     167
    165168#define SPINLOCK_DECLARE(name)
    166169#define SPINLOCK_EXTERN(name)
     
    172175#define SPINLOCK_STATIC_INITIALIZE_NAME(name, desc_name)
    173176
    174 #define ASSERT_SPINLOCK(expr, lock)  ASSERT(expr)
     177#define ASSERT_SPINLOCK(expr, lock)  assert(expr)
    175178
    176179#define spinlock_initialize(lock, name)
    177180
    178181#define spinlock_lock(lock)     preemption_disable()
    179 #define spinlock_trylock(lock)  (preemption_disable(), 1)
     182#define spinlock_trylock(lock)  ({ preemption_disable(); 1; })
    180183#define spinlock_unlock(lock)   preemption_enable()
    181184#define spinlock_locked(lock)   1
Note: See TracChangeset for help on using the changeset viewer.