* cygtls.h (struct _local_storage): Add cw_timer member.
* cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer. (_cygtls::fixup_after_fork): Ditto. * tlsoffsets.h: Regenerate. * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define. (struct _TIMER_BASIC_INFORMATION): Define. (NtQueryTimer): Declare function. * thread.h (cancelable_wait): Change timeout argument to PLARGE_INTEGER and provide NULL default. (fast_mutex::lock): Adjust accordingly. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER and default to NULL. * thread.cc (cancelable_wait): Change timeout argument to PLARGE_INTEGER. Initialize _cygtls.locals.cw_timer if needed. Use NT waitable timers for handling timeout. Return remaining time to timeout argument if timeout was relative. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER. Adjust to change in cancelable_wait. (pthread_mutex::lock): Adjust to change in cancelable_wait. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER. Adjust to changes in cancelable_wait and pthread_cond::wait. (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait. (pthread_cond_wait): Ditto. (semaphore::_timedwait): Adjust to change in cancelable_wait. (semaphore::_wait): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. * signal.cc (nanosleep): Ditto. * wait.cc (wait4): Ditto. Fix copyright dates. * times.cc (FACTOR, NSPERSEC): Move from here... * hires.h (FACTOR, NSPERSEC): ...to here.
This commit is contained in:
@ -37,7 +37,8 @@ enum cw_cancel_action
|
||||
cw_no_cancel
|
||||
};
|
||||
|
||||
DWORD cancelable_wait (HANDLE, DWORD, const cw_cancel_action = cw_cancel_self,
|
||||
DWORD cancelable_wait (HANDLE, PLARGE_INTEGER timeout = NULL,
|
||||
const cw_cancel_action = cw_cancel_self,
|
||||
const enum cw_sig_wait = cw_sig_nosig)
|
||||
__attribute__ ((regparm (3)));
|
||||
|
||||
@ -70,7 +71,7 @@ public:
|
||||
void lock ()
|
||||
{
|
||||
if (InterlockedIncrement ((long *) &lock_counter) != 1)
|
||||
cancelable_wait (win32_obj_id, INFINITE, cw_no_cancel, cw_sig_resume);
|
||||
cancelable_wait (win32_obj_id, NULL, cw_no_cancel, cw_sig_resume);
|
||||
}
|
||||
|
||||
void unlock ()
|
||||
@ -517,7 +518,7 @@ public:
|
||||
pthread_mutex_t mtx_cond;
|
||||
|
||||
void unblock (const bool all);
|
||||
int wait (pthread_mutex_t mutex, DWORD dwMilliseconds = INFINITE);
|
||||
int wait (pthread_mutex_t mutex, PLARGE_INTEGER timeout = NULL);
|
||||
|
||||
pthread_cond (pthread_condattr *);
|
||||
~pthread_cond ();
|
||||
|
Reference in New Issue
Block a user