[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:
>Hi.
>
>I made a simple server (mostly based on the example code).
>I am not using (nor will I) another server, and despite not using
>EXTERNAL_POLL
>in my code, libwebsockets still makes the callback with the Lock poll,
>add
>poll fd and unlock poll reasons every time a client connects.
>Is there any way to disable the external poll callbacks performed by
>libwebsockets?
>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
>getting
>the GET_THREAD_ID callback every time libwebsocket_service runs. Is
>there
>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.

-Andy

>Best Regards,
>
>Tiago
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list