Changeset c842f04 in mainline
- Timestamp:
- 2005-09-01T09:19:56Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3b9572
- Parents:
- f944715
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/synch/spinlock.h
rf944715 rc842f04 32 32 #include <arch/types.h> 33 33 #include <typedefs.h> 34 #include <preemption.h> 34 35 35 36 #ifdef __SMP__ … … 49 50 50 51 #define spinlock_initialize(x) 51 #define spinlock_lock(x) 52 #define spinlock_trylock(x) 153 #define spinlock_unlock(x) 52 #define spinlock_lock(x) preemption_disable() 53 #define spinlock_trylock(x) (preemption_disable(), 1) 54 #define spinlock_unlock(x) preemption_enable() 54 55 55 56 #endif -
src/synch/spinlock.c
rf944715 rc842f04 32 32 #include <arch/barrier.h> 33 33 #include <synch/spinlock.h> 34 #include <preemption.h> 34 35 #include <print.h> 35 36 … … 47 48 __address caller = ((__u32 *) &sl)[-1]; 48 49 50 preemption_disable(); 49 51 while (test_and_set(&sl->val)) { 50 52 if (i++ > 300000) { … … 59 61 void spinlock_lock(spinlock_t *sl) 60 62 { 63 preemption_disable(); 64 61 65 /* 62 66 * Each architecture has its own efficient/recommended … … 72 76 int rc; 73 77 78 preemption_disable(); 74 79 rc = !test_and_set(&sl->val); 75 80 CS_ENTER_BARRIER(); 81 82 if (!rc) 83 preemption_enable(); 76 84 77 85 return rc; … … 82 90 CS_LEAVE_BARRIER(); 83 91 sl->val = 0; 92 preemption_enable(); 84 93 } 85 94
Note:
See TracChangeset
for help on using the changeset viewer.