File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -350,6 +350,8 @@ int pc_client_poll(pc_client_t* client)
350350 return PC_RC_ERROR ;
351351 }
352352
353+ pc_mutex_lock (& client -> event_mutex );
354+
353355 /*
354356 * `is_in_poll` is used to avoid recursive invocation of pc_client_poll
355357 * by identical thread as `pc_mutex_t` is recursive.
@@ -360,7 +362,6 @@ int pc_client_poll(pc_client_t* client)
360362 if (!client -> is_in_poll ) {
361363 client -> is_in_poll = 1 ;
362364
363- pc_mutex_lock (& client -> event_mutex );
364365 while (!QUEUE_EMPTY (& client -> pending_ev_queue )) {
365366 q = QUEUE_HEAD (& client -> pending_ev_queue );
366367 ev = (pc_event_t * ) QUEUE_DATA (q , pc_event_t , queue );
@@ -375,10 +376,10 @@ int pc_client_poll(pc_client_t* client)
375376 pc__handle_event (client , ev );
376377 pc_mutex_lock (& client -> event_mutex );
377378 }
378- pc_mutex_unlock (& client -> event_mutex );
379379 client -> is_in_poll = 0 ;
380380 }
381381
382+ pc_mutex_unlock (& client -> event_mutex );
382383
383384 return PC_RC_OK ;
384385}
You can’t perform that action at this time.
0 commit comments