File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,11 @@ gtp_pppoe_worker_task(void *arg)
353
353
}
354
354
355
355
signal_noignore_sig (SIGUSR1 );
356
+
357
+ /* Set Cancellation before a blocking syscall such as recvmmsg() */
358
+ pthread_setcancelstate (PTHREAD_CANCEL_ENABLE , NULL );
359
+ pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS , NULL );
360
+
356
361
log_message (LOG_INFO , "%s(): Starting PPPoE Worker %s"
357
362
, __FUNCTION__ , pname );
358
363
@@ -419,6 +424,8 @@ gtp_pppoe_worker_release(gtp_pppoe_worker_t *w)
419
424
return ;
420
425
421
426
pthread_kill (w -> task , SIGUSR1 );
427
+ sched_yield (); /* yield to handle the SIGUSR1 */
428
+ pthread_cancel (w -> task ); /* stop all the blocking syscalls, recvmmsg() */
422
429
pthread_join (w -> task , NULL );
423
430
mpkt_destroy (& w -> mpkt );
424
431
pkt_queue_destroy (& w -> pkt_q );
You can’t perform that action at this time.
0 commit comments