Changeset 19937 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- May 23, 2009 12:43:34 PM (16 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/linux
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r8245 r19937 36 36 #include <iprt/thread.h> 37 37 #include <iprt/err.h> 38 #include <iprt/assert.h> 38 39 39 40 … … 67 68 } 68 69 70 71 RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread) 72 { 73 Assert(hThread == NIL_RTTHREAD); 74 return !in_atomic() && !irqs_disabled(); 75 } 76 77 78 RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread) 79 { 80 Assert(hThread == NIL_RTTHREAD); 81 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4) 82 return test_tsk_thread_flag(current, TIF_NEED_RESCHED); 83 84 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20) 85 return need_resched(); 86 87 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 1, 110) 88 return current->need_resched != 0; 89 90 #else 91 return need_resched != 0; 92 #endif 93 } 94 95 96 RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState) 97 { 98 AssertPtr(pState); 99 Assert(pState->uchDummy != 42); 100 pState->uchDummy = 42; 101 102 /* 103 * Note: This call is a NOP if CONFIG_PREEMPT is not enabled in the Linux kernel 104 * configuration. In that case, schedule() is only called need_resched() is set 105 * which is tested just before we return to R3 (not when returning from R0 to R0). 106 */ 107 preempt_disable(); 108 } 109 110 111 RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState) 112 { 113 AssertPtr(pState); 114 Assert(pState->uchDummy == 42); 115 pState->uchDummy = 0; 116 117 preempt_enable(); 118 } 119 -
trunk/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
r19912 r19937 48 48 49 49 50 RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)51 {52 Assert(hThread == NIL_RTTHREAD);53 return !in_atomic() && !irqs_disabled();54 }55 50 56 57 RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread)58 {59 Assert(hThread == NIL_RTTHREAD);60 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4)61 return test_tsk_thread_flag(current, TIF_NEED_RESCHED);62 63 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20)64 return need_resched();65 66 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 1, 110)67 return current->need_resched != 0;68 69 #else70 return need_resched != 0;71 #endif72 }73
Note:
See TracChangeset
for help on using the changeset viewer.