Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/unified_locking/locks.cfa

    r0fc447c r5a46e09  
    1515condition_variable( owner_lock ) c_o;
    1616
     17fast_lock f;
     18condition_variable( fast_lock ) c_f;
     19
    1720linear_backoff_then_block_lock l;
    1821condition_variable( linear_backoff_then_block_lock ) c_l;
     
    7174                }
    7275                unlock(s);
     76        }
     77}
     78
     79thread T_C_F_WS1 {};
     80
     81void main( T_C_F_WS1 & this ) {
     82        for (unsigned int i = 0; i < num_times; i++) {
     83                lock(f);
     84                if(empty(c_f) && i != num_times - 1) {
     85                        wait(c_f,f);
     86                }else{
     87                        notify_one(c_f);
     88                }
     89                unlock(f);
     90        }
     91}
     92
     93thread T_C_F_WB1 {};
     94
     95void main( T_C_F_WB1 & this ) {
     96        for (unsigned int i = 0; i < num_times; i++) {
     97                lock(f);
     98                if(counter(c_f) == 3 || i == num_times - 1) {
     99                        notify_all(c_f);
     100                }else{
     101                        wait(c_f,f);
     102                }
     103                unlock(f);
    73104        }
    74105}
     
    286317        printf("Done Test 6\n");
    287318
    288         printf("Start Test 7: linear backoff lock and condition variable single wait/notify\n");
     319        printf("Start Test 7: fast lock and condition variable single wait/notify\n");
     320        {
     321                T_C_F_WS1 t1[2];
     322        }
     323        printf("Done Test 7\n");
     324
     325        printf("Start Test 8: fast lock and condition variable 3 wait/notify all\n");
     326        {
     327                T_C_F_WB1 t1[4];
     328        }
     329        printf("Done Test 8\n");
     330
     331        printf("Start Test 9: linear backoff lock and condition variable single wait/notify\n");
    289332        {
    290333                T_C_L_WS1 t1[2];
    291334        }
    292         printf("Done Test 7\n");
    293 
    294         printf("Start Test 8: linear backoff lock and condition variable 3 wait/notify all\n");
     335        printf("Done Test 9\n");
     336
     337        printf("Start Test 10: linear backoff lock and condition variable 3 wait/notify all\n");
    295338        {
    296339                T_C_L_WB1 t1[4];
    297340        }
    298         printf("Done Test 8\n");
    299 
    300         printf("Start Test 9: multi acquisiton lock and condition variable multiple acquire and wait/notify\n");
     341        printf("Done Test 10\n");
     342
     343        printf("Start Test 11: multi acquisiton lock and condition variable multiple acquire and wait/notify\n");
    301344        {
    302345                T_C_M_WS2 t1[2];
    303346        }
    304         printf("Done Test 9\n");
    305 
    306         printf("Start Test 10: owner lock and condition variable multiple acquire and wait/notify\n");
     347        printf("Done Test 11\n");
     348
     349        printf("Start Test 12: owner lock and condition variable multiple acquire and wait/notify\n");
    307350        {
    308351                T_C_O_WS2 t1[2];
    309352        }
    310         printf("Done Test 10\n");
    311 
    312         printf("Start Test 11: no lock condition variable wait/notify\n");
     353        printf("Done Test 12\n");
     354
     355        printf("Start Test 13: no lock condition variable wait/notify\n");
    313356        {
    314357                T_C_NLW t1;
    315358                T_C_NLS t2;
    316359        }
    317         printf("Done Test 11\n");
    318 
    319         printf("Start Test 12: locked condition variable wait/notify with front()\n");
     360        printf("Done Test 13\n");
     361
     362        printf("Start Test 14: locked condition variable wait/notify with front()\n");
    320363        {
    321364                T_C_S_WNF t1[2];
    322365        }
    323         printf("Done Test 12\n");
    324 }
     366        printf("Done Test 14\n");
     367}
Note: See TracChangeset for help on using the changeset viewer.