Changeset b68fc85
- Timestamp:
- May 2, 2018, 5:38:06 PM (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, with_gc
- Children:
- d28a03e, fb16d5c
- Parents:
- 9d32bc8
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/preemption.c
r9d32bc8 rb68fc85 404 404 } 405 405 406 //============================================================================================= 407 // Kernel Signal Debug 408 //============================================================================================= 409 410 void __cfaabi_check_preemption() { 411 bool ready = TL_GET( preemption_state ).enabled; 412 if(!ready) { abort("Preemption should be ready"); } 413 414 sigset_t oldset; 415 int ret; 416 ret = sigprocmask(0, NULL, &oldset); 417 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 418 419 ret = sigismember(&oldset, SIGUSR1); 420 if(ret < 0) { abort("ERROR sigismember returned %d", ret); } 421 422 if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); } 423 } 424 406 425 // Local Variables: // 407 426 // mode: c // -
src/tests/concurrent/preempt.c
r9d32bc8 rb68fc85 17 17 #endif 18 18 19 extern void __cfaabi_check_preemption(); 20 19 21 static volatile int counter = 0; 20 22 … … 29 31 void main(worker_t & this) { 30 32 while(counter < N) { 33 __cfaabi_check_preemption(); 31 34 if( (counter % 7) == this.value ) { 35 __cfaabi_check_preemption(); 32 36 int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST); 37 __cfaabi_check_preemption(); 33 38 if( (next % 100) == 0 ) printf("%d\n", (int)next); 39 __cfaabi_check_preemption(); 34 40 } 41 __cfaabi_check_preemption(); 35 42 } 36 43 }
Note: See TracChangeset
for help on using the changeset viewer.