[RFC PATCH v4 3/5] server: Attempt to complete I/O request immediately in recv_socket.

Jinoh Kang jinoh.kang.kr at gmail.com
Thu Feb 3 10:26:46 CST 2022


On 2/3/22 08:45, Zebediah Figura wrote:
> On 1/29/22 01:47, Jinoh Kang wrote:
>> diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
>> index 442243d8bcf..4cb30479322 100644
>> --- a/dlls/ntdll/unix/sync.c
>> +++ b/dlls/ntdll/unix/sync.c
>> @@ -2510,3 +2510,25 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
>>   }
>>     #endif
>> +
>> +/* Notify direct completion of async and close the wait handle if it is no longer needed.
>> + * This function is a no-op (returns status as-is) if the supplied handle is NULL.
>> + */
>> +NTSTATUS notify_async( HANDLE *optional_handle, NTSTATUS status, ULONG_PTR information )
> 
> This function seems rather ambiguously named. Why not use the same name as for the server request?

Ack.

> 
>> +{
>> +    NTSTATUS ret;
>> +
>> +    if (!*optional_handle) return status;
>> +
>> +    SERVER_START_REQ( notify_async_direct_result )
>> +    {
>> +        req->handle      = wine_server_obj_handle( *optional_handle );
>> +        req->status      = status;
>> +        req->information = information;
>> +        ret = wine_server_call( req );
>> +        *optional_handle = wine_server_ptr_handle( reply->handle );
>> +    }
>> +    SERVER_END_REQ;
>> +
>> +    return ret;
>> +}
> 
> ...
> 
>> diff --git a/server/protocol.def b/server/protocol.def
>> index d79eca074a0..137e6c5a220 100644
>> --- a/server/protocol.def
>> +++ b/server/protocol.def
>> @@ -1456,6 +1456,7 @@ enum server_fd_type
>>   @REPLY
>>       obj_handle_t wait;          /* handle to wait on for blocking recv */
>>       unsigned int options;       /* device open options */
>> +    int          may_restart;   /* May restart async? */
>>   @END
>>     
> 
> "may_restart" takes me a minute to realize what it actually means. Could we just return the (non)blocking flag directly instead?

So we do "force_async || !nonblocking" at the client side, I guess?

-- 
Sincerely,
Jinoh Kang



More information about the wine-devel mailing list