http://bugs.winehq.org/show_bug.cgi?id=59440 --- Comment #5 from admin@uright.icu --- Comment on attachment 82256 --> http://bugs.winehq.org/attachment.cgi?id=82256 alertable-delay-fast-path diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 829c712..daf6d26 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -445,7 +445,12 @@ static NTSTATUS linux_wait_objs( int device, DWORD count, const int *objs, WAIT_ return type != WaitAll ? args.index : 0; } if (errno == EOWNERDEAD) return STATUS_ABANDONED + (type != WaitAll ? args.index : 0); - if (errno == ETIMEDOUT) return STATUS_TIMEOUT; + if (errno == ETIMEDOUT) + { + /* match server_wait(), which always yields on a timed out wait */ + NtYieldExecution(); + return STATUS_TIMEOUT; + } return errno_to_status( errno ); } @@ -904,6 +909,7 @@ static NTSTATUS inproc_wait( DWORD count, const HANDLE *handles, WAIT_TYPE type, NTSTATUS ret; if (inproc_device_fd < 0) return STATUS_NOT_IMPLEMENTED; + if (alertable && (alert_fd = get_inproc_alert_fd()) < 0) return STATUS_NOT_IMPLEMENTED; assert( count <= ARRAY_SIZE(syncs) ); objs[0] = -1; /* make gcc happy, otherwise it thinks objs is not initialized */ @@ -917,7 +923,6 @@ static NTSTATUS inproc_wait( DWORD count, const HANDLE *handles, WAIT_TYPE type, objs[i] = syncs[i]->fd; } - if (alertable) alert_fd = get_inproc_alert_fd(); ret = linux_wait_objs( inproc_device_fd, count, objs, type, alert_fd, timeout ); while (count--) release_inproc_sync( syncs[count] ); @@ -2423,9 +2428,16 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou { unsigned int status = STATUS_SUCCESS; - /* if alertable, we need to query the server */ + /* if alertable, try the in-proc fast path first, otherwise we need to + query the server */ if (alertable) { + if ((status = inproc_wait( 0, NULL, WaitAny, TRUE, timeout )) != STATUS_NOT_IMPLEMENTED) + { + if (status == STATUS_TIMEOUT) status = STATUS_SUCCESS; + return status; + } + /* Since server_wait will result in an unconditional implicit yield, we never return STATUS_NO_YIELD_PERFORMED */ if ((status = server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, timeout )) == STATUS_TIMEOUT) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.