Changeset b227f68 for src/libcfa/concurrency/preemption.c
- Timestamp:
- Jun 29, 2017, 11:59:09 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- b751c8e
- Parents:
- 7bbba76
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/preemption.c
r7bbba76 rb227f68 158 158 //============================================================================================= 159 159 160 LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; ) 161 160 162 extern "C" { 161 163 void disable_interrupts() { … … 187 189 188 190 static inline void signal_unblock( int sig ) { 189 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p unblocking sig %i\n", this_processor, sig ); 191 // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p unblocking sig %i\n", this_processor, sig ); 192 193 // LIB_DEBUG_DO( 194 // sigset_t waiting; 195 // sigemptyset(&waiting); 196 // sigpending(&waiting); 197 // verify( !sigismember(&waiting, sig) ); 198 // ) 190 199 191 200 sigset_t mask; … … 217 226 218 227 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) { 219 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ctx Switch IRH %p running %p @ %p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) ); 228 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "CtxSw IRH %10p running %10p @ %10p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) ); 229 LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[REG_RIP]); ) 220 230 221 231 if( preemption_ready() ) { 222 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Blocking thread %p on %p\n", this_thread, this_processor );232 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Blocking thread %p on %p\n", this_thread, this_processor ); 223 233 signal_unblock( SIGUSR1 ); 224 234 BlockInternal( (thread_desc*)this_thread ); 225 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Back\n\n");235 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Back\n\n"); 226 236 } 227 237 else { 228 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Defering\n" );238 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Defering\n" ); 229 239 defer_ctxSwitch(); 230 240 signal_unblock( SIGUSR1 ); … … 233 243 234 244 void sigHandler_alarm( __CFA_SIGPARMS__ ) { 235 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "\nAlarm IRH %p running %p @ %p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) ); 236 237 // if( ((intptr_t)cxt->uc_mcontext.gregs[REG_RIP]) > 0xFFFFFF ) __debug_break(); 245 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "\nAlarm IRH %10p running %10p @ %10p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) ); 246 LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[REG_RIP]); ) 238 247 239 248 if( try_lock( &systemProcessor->alarm_lock DEBUG_CTX2 ) ) { … … 248 257 249 258 if( preemption_ready() && this_processor->pending_preemption ) { 250 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm IRH : Blocking thread %p on %p\n", this_thread, this_processor );259 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm IRH : Blocking thread %p on %p\n", this_thread, this_processor ); 251 260 this_processor->pending_preemption = false; 252 261 BlockInternal( (thread_desc*)this_thread ); 253 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm Switch IRH : Back\n\n");262 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm Switch IRH : Back\n\n"); 254 263 } 255 264 }
Note: See TracChangeset
for help on using the changeset viewer.