[Libwebsockets] Question regarding external poll management support and LWS_CALLBACK_GET_THREAD_ID reason

Andy Green andy at warmcat.com
Tue Oct 7 04:23:24 CEST 2014

On 7 October 2014 00:17:14 GMT+08:00, Tiago Costa <tiago.rocha.alves.costa at gmail.com> wrote:
>I made a simple server (mostly based on the example code).
>I am not using (nor will I) another server, and despite not using
>in my code, libwebsockets still makes the callback with the Lock poll,
>poll fd and unlock poll reasons every time a client connects.
>Is there any way to disable the external poll callbacks performed by
>Or should I simply ignore this?

As it is, you should ignore it.  The call is very cheap if you have no handler.

>Also, I am supplying a thread ID (via callback return), but I keep
>the GET_THREAD_ID callback every time libwebsocket_service runs. Is
>something wrong or should I simply ignore this as well?

Yes if no threading then no need to deal with it, just let it return 0.

>Further down the road I will thread the server in order to integrate it
>with a larger project.

Then probably just let it be for now.

Arguably it might be good to have a config option to strip all this.  It's only needed or useful in the case that there are multiple threads and that's probably not the most common way lws is used.

But for your situation you just didn't add the other threads yet, there is no problem caused by not handling these callbacks.


>Best Regards,
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list