Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/unified_locking/pthread_locks.cfa

    r4e83bb7 r55422cf  
    33#include <stdlib.hfa>
    44#include <thread.hfa>
    5 #include <time.h>
    6 #include <stdlib.hfa>
    75
    8 const unsigned int num_times = 50;
     6const unsigned int num_times = 50000;
    97
    108simple_owner_lock l;
    119pthread_cond_var( simple_owner_lock ) c;
    12 
    13 owner_lock l2;
    14 condition_variable( owner_lock ) c2;
    1510
    1611volatile int counter = 0;
     
    6459}
    6560
    66 thread Wait_Time_Signal_1 {};
    67 
    68 void main( Wait_Time_Signal_1 & this ) {
    69         for (unsigned int i = 0; i < num_times; i++) {
    70                 lock(l);
    71                 if(empty(c) || random(10) >= 9 ) {
    72                         timespec t;
    73                         clock_gettime(CLOCK_REALTIME, &t);
    74                         timespec waitTime{0,1};
    75                         bool woken = wait(c,l, t + waitTime);
    76                 }else{
    77                         notify_one(c);
    78                 }
    79                 unlock(l);
    80         }
    81 }
    82 
    8361int main() {
    84         processor p[1];
     62        processor p[3];
    8563        printf("Start Test 1: lock and condition variable single wait/notify\n");
    8664        {
     
    10078        }
    10179        printf("Done Test 3\n");
    102 
    103         printf("Start Test 4: lock and condition variable single timed wait/notify\n");
    104         {
    105                 Wait_Time_Signal_1 t1[2];
    106         }
    107         printf("Done Test 4\n");
    10880}
Note: See TracChangeset for help on using the changeset viewer.