Ignore:
Timestamp:
Mar 31, 2021, 1:48:15 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c7c178b
Parents:
f621e43f
Message:

Changed is_blocking_lock trait to use on_wakeup.
Fixed fast_lock to work with conditions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/unified_locking/locks.cfa

    rf621e43f r22b7579  
    1515condition_variable( owner_lock ) c_o;
    1616
     17fast_lock f;
     18condition_variable( fast_lock ) c_f;
     19
    1720thread T_C_M_WS1 {};
    1821
     
    6871                }
    6972                unlock(s);
     73        }
     74}
     75
     76thread T_C_F_WS1 {};
     77
     78void main( T_C_F_WS1 & this ) {
     79        for (unsigned int i = 0; i < num_times; i++) {
     80                lock(f);
     81                if(empty(c_f) && i != num_times - 1) {
     82                        wait(c_f,f);
     83                }else{
     84                        notify_one(c_f);
     85                }
     86                unlock(f);
     87        }
     88}
     89
     90thread T_C_F_WB1 {};
     91
     92void main( T_C_F_WB1 & this ) {
     93        for (unsigned int i = 0; i < num_times; i++) {
     94                lock(f);
     95                if(counter(c_f) == 3 || i == num_times - 1) {
     96                        notify_all(c_f);
     97                }else{
     98                        wait(c_f,f);
     99                }
     100                unlock(f);
    70101        }
    71102}
     
    255286        printf("Done Test 6\n");
    256287
    257         printf("Start Test 7: multi acquisiton lock and condition variable multiple acquire and wait/notify\n");
     288        printf("Start Test 7: fast lock and condition variable single wait/notify\n");
     289        {
     290                T_C_F_WS1 t1[2];
     291        }
     292        printf("Done Test 7\n");
     293
     294        printf("Start Test 8: fast lock and condition variable 3 wait/notify all\n");
     295        {
     296                T_C_F_WB1 t1[4];
     297        }
     298        printf("Done Test 8\n");
     299
     300        printf("Start Test 9: multi acquisiton lock and condition variable multiple acquire and wait/notify\n");
    258301        {
    259302                T_C_M_WS2 t1[2];
    260303        }
    261         printf("Done Test 7\n");
    262 
    263         printf("Start Test 8: owner lock and condition variable multiple acquire and wait/notify\n");
     304        printf("Done Test 9\n");
     305
     306        printf("Start Test 10: owner lock and condition variable multiple acquire and wait/notify\n");
    264307        {
    265308                T_C_O_WS2 t1[2];
    266309        }
    267         printf("Done Test 8\n");
    268 
    269         printf("Start Test 9: no lock condition variable wait/notify\n");
     310        printf("Done Test 10\n");
     311
     312        printf("Start Test 11: no lock condition variable wait/notify\n");
    270313        {
    271314                T_C_NLW t1;
    272315                T_C_NLS t2;
    273316        }
    274         printf("Done Test 9\n");
    275 
    276         printf("Start Test 10: locked condition variable wait/notify with front()\n");
     317        printf("Done Test 11\n");
     318
     319        printf("Start Test 12: locked condition variable wait/notify with front()\n");
    277320        {
    278321                T_C_S_WNF t1[2];
    279322        }
    280         printf("Done Test 10\n");
     323        printf("Done Test 12\n");
    281324
    282325        // removed to limit test duration. Full test is in long run tests
Note: See TracChangeset for help on using the changeset viewer.