[Libwebsockets] libwebsocket LWS_CALLBACK_GET_THREAD_ID

Andy Green andy at warmcat.com
Sat Jul 5 05:38:45 CEST 2014



On 05/26/2014 02:53 PM, Micka wrote:
> Hi,
>
> I wanted to know if it's normal that in my protocol function I received
> a lot of LWS_CALLBACK_GET_THREAD_ID
>
> It happens all the time .....

Yes it's normal, it's used to understand if you're asking for a 
writeable callback from another thread.

It shouldn't be happening if your system is otherwise idle, lws CPU 
should be like 0%.

But if your server is active you'll be getting these when it does 
something.  pthread_self should be really cheap though.

-Andy

> that is my return :
>
>     return pthread_self();
>
> And I don't use that :
> /*
> * if you will call "libwebsocket_callback_on_writable"
> * from a different thread, return the caller thread ID
> * here so lws can use this information to work out if it
> * should signal the poll() loop to exit and restart early
> */
>
>
> Thx,
>
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>



More information about the Libwebsockets mailing list