Module: wine Branch: master Commit: 9e581ba8c5b4a2f8e2807eeb2c5f800f1b650d01 URL: https://source.winehq.org/git/wine.git/?a=commit;h=9e581ba8c5b4a2f8e2807eeb2...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Feb 5 11:49:35 2020 +0100
server: Improve APC error handling when alloc_handle fails.
Whenever alloc_handle fails, we ignored the error and dequeued the next APC. This patch makes the loop break whenever the error status changes.
Note that the APC is still marked as executed although it failed.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
server/thread.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/server/thread.c b/server/thread.c index 80db41b48d..5844d03968 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1579,26 +1579,23 @@ DECL_HANDLER(select)
reply->timeout = select_on( &select_op, op_size, req->cookie, req->flags, req->timeout );
- if (get_error() == STATUS_USER_APC) + while (get_error() == STATUS_USER_APC) { - for (;;) + if (!(apc = thread_dequeue_apc( current, !(req->flags & SELECT_ALERTABLE) ))) + break; + /* Optimization: ignore APC_NONE calls, they are only used to + * wake up a thread, but since we got here the thread woke up already. + */ + if (apc->call.type != APC_NONE && + (reply->apc_handle = alloc_handle( current->process, apc, SYNCHRONIZE, 0 ))) { - if (!(apc = thread_dequeue_apc( current, !(req->flags & SELECT_ALERTABLE) ))) - break; - /* Optimization: ignore APC_NONE calls, they are only used to - * wake up a thread, but since we got here the thread woke up already. - */ - if (apc->call.type != APC_NONE && - (reply->apc_handle = alloc_handle( current->process, apc, SYNCHRONIZE, 0 ))) - { - reply->call = apc->call; - release_object( apc ); - break; - } - apc->executed = 1; - wake_up( &apc->obj, 0 ); + reply->call = apc->call; release_object( apc ); + break; } + apc->executed = 1; + wake_up( &apc->obj, 0 ); + release_object( apc ); } }