Cygwin: implement extensible clock interface
- Drop hires_[nm]s clocks, rename hires.h to clock.h. - Implement clk_t class as an extensible clock class in new file clock.cc. - Introduce get_clock(clock_id) returning a pointer to the clk_t instance for clock_id. Provide the following methods along the lines of the former hires classes: void clk_t::nsecs (struct timespec *); ULONGLONG clk_t::nsecs (); LONGLONG clk_t::usecs (); LONGLONG clk_t::msecs (); void clk_t::resolution (struct timespec *); - Add CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME clocks. - Allow clock_nanosleep, pthread_condattr_setclock and timer_create to use all new clocks (both clocks should be usable with a small tweak, though). - Bump DLL major version to 2.12. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -24,7 +24,6 @@
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "hires.h"
|
||||
#include "shared_info.h"
|
||||
#include "ntdll.h"
|
||||
#include "miscfuncs.h"
|
||||
@ -1269,7 +1268,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name)
|
||||
pwbuf->NameLength = pipe_name->Length;
|
||||
pwbuf->TimeoutSpecified = TRUE;
|
||||
memcpy (pwbuf->Name, pipe_name->Buffer, pipe_name->Length);
|
||||
stamp = ntod.nsecs ();
|
||||
stamp = get_clock (CLOCK_MONOTONIC)->n100secs ();
|
||||
do
|
||||
{
|
||||
status = NtFsControlFile (npfsh, evt, NULL, NULL, &io, FSCTL_PIPE_WAIT,
|
||||
@ -1298,7 +1297,8 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name)
|
||||
/* Another concurrent connect grabbed the pipe instance
|
||||
under our nose. Fix the timeout value and go waiting
|
||||
again, unless the timeout has passed. */
|
||||
pwbuf->Timeout.QuadPart -= (stamp - ntod.nsecs ()) / 100LL;
|
||||
pwbuf->Timeout.QuadPart -=
|
||||
stamp - get_clock (CLOCK_MONOTONIC)->n100secs ();
|
||||
if (pwbuf->Timeout.QuadPart >= 0)
|
||||
{
|
||||
status = STATUS_IO_TIMEOUT;
|
||||
|
Reference in New Issue
Block a user