[Libwebsockets] threads?!

Alexander Zvyagin zvyagin.alexander at gmail.com
Wed Mar 13 16:47:58 CET 2019


OK, now I understand what is happening, but I still don't know how to
fix my code.

The problem is that when I call lws_cancel_service(context) from a
worker thread, it does trigger callback in the main thread with
LWS_CALLBACK_EVENT_WAIT_CANCELLED, but this happens with user==NULL,
so the actual code:

    case LWS_CALLBACK_EVENT_WAIT_CANCELLED: {
        if( user )
            lws_callback_on_writable(wsi);
        break;
    }

... will not execute lws_callback_on_writable() because of the check
user!=NULL. And if I remove the check, the code crashes.

Any suggestions how to fix that?

Thanks a lot in advance,
Alexander.


More information about the Libwebsockets mailing list