Changeset 1afda5a2 for tests


Ignore:
Timestamp:
Dec 19, 2022, 9:37:55 PM (3 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
199456c, ebbe941
Parents:
8e64cb4 (diff), d18540f (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

Location:
tests/concurrent/pthread
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrent/pthread/.expect/bounded_buffer.txt

    r8e64cb4 r1afda5a2  
    1 producer total value is 23426
    2 consumer total value is 23426
     1producer total value is 24150
     2consumer total value is 24150
  • tests/concurrent/pthread/bounded_buffer.cfa

    r8e64cb4 r1afda5a2  
    6363
    6464void *producer( void *arg ) {
    65         Buffer(int) &buf = *(Buffer(int)*)arg;
    66         const int NoOfItems = rand() % 40;
     65    Buffer(int) &buf = *(Buffer(int)*)arg;
     66        const int NoOfItems = prng(*active_thread(), 40);
    6767        int item;
    6868        for ( int i = 1; i <= NoOfItems; i += 1 ) {                     // produce a bunch of items
    69                 item = rand() % 100 + 1;                                                // produce a random number
     69                item = prng(*active_thread(), 1, 101);                  // produce a random number
    7070                //sout | "Producer:" | pthread_self() | " value:" | item;
    7171                insert( buf,item );                                                             // insert element into queue
     
    101101    pthread_mutex_init(&consumer_cnt_lock, NULL);
    102102        // parallelism
    103     srandom( 1003 );
     103    set_seed( 1003 );
    104104
    105105        processor p[5];
Note: See TracChangeset for help on using the changeset viewer.