Changeset 25435

Show
Ignore:
Timestamp:
05/10/08 16:44:03 (6 days ago)
Author:
bonefish
Message:
Use the new B_ABSOLUTE_REAL_TIME_TIMEOUT. Fixes pthread_cond_timedwait()
and pthread_mutex_timedlock() which were waiting system time relative
although their timeout parameter is Epoch relative.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • haiku/trunk/src/system/kernel/posix/realtime_sem.cpp

    r25362 r25435  
    1616#include <kernel.h> 
    1717#include <lock.h> 
    18 #include <real_time_clock.h> 
    1918#include <syscall_restart.h> 
    2019#include <team.h> 
     
    741740                        error = acquire_sem_etc(id, 1, B_CAN_INTERRUPT, 0); 
    742741                } else { 
    743                         error = acquire_sem_etc(id, 1, B_CAN_INTERRUPT | B_ABSOLUTE_TIMEOUT, 
    744                                 timeout - rtc_boot_time()); 
    745                                         // The given absolute timeout is relative to the Epoch. 
     742                        error = acquire_sem_etc(id, 1, 
     743                                B_CAN_INTERRUPT | B_ABSOLUTE_REAL_TIME_TIMEOUT, timeout); 
    746744                } 
    747745 
  • haiku/trunk/src/system/libroot/posix/pthread/pthread_cond.c

    r22281 r25435  
    109109        do { 
    110110                status = acquire_sem_etc(cond->sem, 1, 
    111                         timeout == B_INFINITE_TIMEOUT ? 0 : B_ABSOLUTE_TIMEOUT, timeout); 
     111                        timeout == B_INFINITE_TIMEOUT ? 0 : B_ABSOLUTE_REAL_TIME_TIMEOUT, 
     112                        timeout); 
    112113        } while (status == B_OK && atomic_get(&cond->event_counter) == event); 
    113114 
  • haiku/trunk/src/system/libroot/posix/pthread/pthread_mutex.c

    r17895 r25435  
    148148                // this mutex is already locked by someone else, so we need 
    149149                // to wait 
    150                 status = acquire_sem_etc(mutex->sem, 1, timeout == B_INFINITE_TIMEOUT ? 0 : B_ABSOLUTE_TIMEOUT, timeout); 
     150                status = acquire_sem_etc(mutex->sem, 1, 
     151                        timeout == B_INFINITE_TIMEOUT ? 0 : B_ABSOLUTE_REAL_TIME_TIMEOUT, 
     152                        timeout); 
    151153        } 
    152154