Changeset c842f04 in mainline for src/synch/spinlock.c
- Timestamp:
- 2005-09-01T09:19:56Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3b9572
- Parents:
- f9447155
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/synch/spinlock.c
rf9447155 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.