1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Make the Windows pipe more responsive

Otherwise it often forgets to inform about event loop interrupts.  Add a flag to the per thread context, set it in the signal function, then check / reset it in the service method.
This commit is contained in:
Jim Borden 2019-06-25 12:08:39 +01:00 committed by Andy Green
parent 805c033b6b
commit 1979bd8cc9
3 changed files with 10 additions and 0 deletions

View file

@ -344,6 +344,9 @@ struct lws_context_per_thread {
unsigned char inside_service:1;
unsigned char event_loop_foreign:1;
unsigned char event_loop_destroy_processing_done:1;
#ifdef _WIN32
unsigned char interrupt_requested:1;
#endif
};
struct lws_conn_stats {

View file

@ -35,6 +35,7 @@ lws_plat_pipe_signal(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
pt->interrupt_requested = 1;
WSASetEvent(pt->events); /* trigger the cancel event */
return 0;

View file

@ -137,6 +137,12 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
ev = WSAWaitForMultipleEvents(1, &pt->events, FALSE, timeout_ms, FALSE);
if (ev == WSA_WAIT_EVENT_0) {
if(pt->interrupt_requested) {
pt->interrupt_requested = 0;
lws_broadcast(context, LWS_CALLBACK_EVENT_WAIT_CANCELLED, NULL, 0);
return 0;
}
unsigned int eIdx;
#if defined(LWS_WITH_TLS)