Changeset b68fc85


Ignore:
Timestamp:
May 2, 2018, 5:38:06 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
d28a03e, fb16d5c
Parents:
9d32bc8
Message:

Added more checks to preempt test to make sure preemption stays enabled

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/preemption.c

    r9d32bc8 rb68fc85  
    404404}
    405405
     406//=============================================================================================
     407// Kernel Signal Debug
     408//=============================================================================================
     409
     410void __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
    406425// Local Variables: //
    407426// mode: c //
  • src/tests/concurrent/preempt.c

    r9d32bc8 rb68fc85  
    1717#endif
    1818
     19extern void __cfaabi_check_preemption();
     20
    1921static volatile int counter = 0;
    2022
     
    2931void main(worker_t & this) {
    3032        while(counter < N) {
     33                __cfaabi_check_preemption();
    3134                if( (counter % 7) == this.value ) {
     35                        __cfaabi_check_preemption();
    3236                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
     37                        __cfaabi_check_preemption();
    3338                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
     39                        __cfaabi_check_preemption();
    3440                }
     41                __cfaabi_check_preemption();
    3542        }
    3643}
Note: See TracChangeset for help on using the changeset viewer.