[Libwebsockets] Using libuv threads with libwebsockets in windows

Andy Green andy at warmcat.com
Thu May 26 07:43:23 CEST 2016

On 05/26/2016 01:31 PM, Meir Yanovich wrote:
> Hello
> libwebsockets is using pthreads according to test-server-pthreads.c ,

Well, it *can* use pthreads is what you should draw from that.

That version of the test server is showing how to do the test server 
things if you wanted to do them in pthreads.  But it's optional.  By 
default, lws has no pthreads code arranged to be built and no dependency 
on it.

> i dont what to install pthreads wrapper on windows .
> so i like to use the one libuv has .
> is it problem from libsockets point of view ?

No, but like libuv itself, lws is designed to work out of a single 
nonblocking thread.  It's not threadsafe.

It's fine if lws + libuv are left alone in their own service thread.  If 
you want to do something from another thread though, the only safe lws 
api to call is lws_callback_on_writable(), triggering the service thread 
to do whatever it is you wanted to do.


> Thanks
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list