Changeset 1066041 in mainline for kernel/generic/include/preemption.h
- Timestamp:
- 2012-07-11T07:58:03Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 935e28c
- Parents:
- b68ae24
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/preemption.h
rb68ae24 r1066041 36 36 #define KERN_PREEMPTION_H_ 37 37 38 extern void preemption_disable(void); 39 extern void preemption_enable(void); 40 extern void preemption_enable_noresched(void); 41 extern void preemption_enabled_scheduler(void); 38 #include <arch.h> 39 #include <compiler/barrier.h> 40 #include <debug.h> 41 42 #define PREEMPTION_INC (1 << 1) 43 #define PREEMPTION_NEEDED_FLAG (1 << 0) 44 #define PREEMPTION_NEEDED (THE->preemption & PREEMPTION_NEEDED_FLAG) 45 #define PREEMPTION_DISABLED (PREEMPTION_INC <= THE->preemption) 46 #define PREEMPTION_ENABLED (!PREEMPTION_DISABLED) 47 48 /** Increment preemption disabled counter. */ 49 #define preemption_disable() \ 50 do { \ 51 THE->preemption += PREEMPTION_INC; \ 52 compiler_barrier(); \ 53 } while (0) 54 55 /** Restores preemption and reschedules if out time slice already elapsed.*/ 56 #define preemption_enable() \ 57 do { \ 58 preemption_enable_noresched(); \ 59 \ 60 if (PREEMPTION_ENABLED && PREEMPTION_NEEDED) { \ 61 preemption_enabled_scheduler(); \ 62 } \ 63 } while (0) 64 65 /** Restores preemption but never reschedules. */ 66 #define preemption_enable_noresched() \ 67 do { \ 68 ASSERT(PREEMPTION_DISABLED); \ 69 compiler_barrier(); \ 70 THE->preemption -= PREEMPTION_INC; \ 71 } while (0) 42 72 43 73 74 extern void preemption_enabled_scheduler(void); 75 extern void preemption_set_needed(void); 76 extern void preemption_clear_needed(void); 44 77 45 78 #endif
Note:
See TracChangeset
for help on using the changeset viewer.