Changeset 160

Show
Ignore:
Timestamp:
10/14/07 03:40:47
Author:
apokayi
Message:

undefined cases from the spec are fixed by enforcing the lock_attempt calls to be made other than the locking thread

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • guts_main/src/lock_attempt.upc

    r132 r160  
    5252        lock1 = upc_all_lock_alloc(); 
    5353 
    54         upc_lock(lock1); 
    55         check_parm = upc_lock_attempt(lock1); 
    56         a = local_a; 
    57         upc_unlock(lock1); 
     54        if (MYTHREAD==0){ 
     55                upc_lock(lock1); 
     56        } 
     57        else { 
     58                check_parm = upc_lock_attempt(lock1); 
     59                a = local_a; 
     60        } 
     61 
     62        if (MYTHREAD ==0) 
     63                upc_unlock(lock1); 
     64 
    5865 
    5966        /* 
     
    8188                a = local_a + MYTHREAD; 
    8289        } 
    83    
    84         upc_barrier; 
    85         check_parm = upc_lock_attempt(lock3); 
     90        else {  
     91                check_parm = upc_lock_attempt(lock3); 
    8692 
    87         if(check_parm != 0) 
    88                 GULA_FAIL("failed to return 0 when the lock is already being used by another thread"); 
    89  
     93                if(check_parm != 0) 
     94                        GULA_FAIL("failed to return 0 when the lock is already being used by another thread"); 
     95        } 
     96         
    9097        upc_barrier; 
    9198