Ignore:
Timestamp:
Nov 8, 2017, 5:43:33 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
954908d
Parents:
78315272 (diff), e35f30a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/sched-int-block.c

    r78315272 r3f7e12cb  
     1//---------------------------------------------------------
     2// Barging test
     3// Ensures that no barging can occur between :
     4//   - the frontend of the signal_block and the signaled thread
     5//   - the signaled  threadand the backend of the signal_block
     6//---------------------------------------------------------
     7
     8
    19#include <fstream>
    210#include <kernel>
     
    3947//------------------------------------------------------------------------------
    4048void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
    41         wait( &cond, (uintptr_t)this_thread );
     49        wait( cond, (uintptr_t)this_thread );
    4250
    43         yield( ((unsigned)rand48()) % 10 );
     51        yield( random( 10 ) );
    4452
    4553        if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) {
     
    5058        a.last_thread = b.last_thread = this_thread;
    5159
    52         yield( ((unsigned)rand48()) % 10 );
     60        yield( random( 10 ) );
    5361}
    5462
     
    6270//------------------------------------------------------------------------------
    6371void signal_op( global_data_t & mutex a, global_data_t & mutex b ) {
    64         yield( ((unsigned)rand48()) % 10 );
     72        yield( random( 10 ) );
    6573
    6674        [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread;
    6775
    68         if( !is_empty( &cond ) ) {
     76        if( !is_empty( cond ) ) {
    6977
    70                 thread_desc * next = front( &cond );
     78                thread_desc * next = front( cond );
    7179
    72                 if( ! signal_block( &cond ) ) {
     80                if( ! signal_block( cond ) ) {
    7381                        sout | "ERROR expected to be able to signal" | endl;
    7482                        abort();
    7583                }
    7684
    77                 yield( ((unsigned)rand48()) % 10 );
     85                yield( random( 10 ) );
    7886
    7987                if(a.last_thread != next || b.last_thread != next) {
     
    110118
    111119int main(int argc, char* argv[]) {
    112         rand48seed( time( NULL ) );
     120        random_seed( time( NULL ) );
    113121        done = false;
    114122        processor p;
Note: See TracChangeset for help on using the changeset viewer.