[Libwebsockets] [libwebsockets] #56: how to efficiently block for incoming messages, but unblock to send?

Trac trac at libwebsockets.org
Wed Feb 26 00:54:59 CET 2014


#56: how to efficiently block for incoming messages, but unblock to send?
-----------------------------------------+-----------------
 Reporter:  supertwang                   |      Owner:
     Type:  task                         |     Status:  new
 Priority:  minor                        |  Milestone:
Component:  libwebsocket test apps       |    Version:
 Keywords:  block blocking thread async  |
-----------------------------------------+-----------------
 Hi, I am trying to accomplish bi-directional communication with a (non-
 libwebsockets) server from a libwebsockets client app.  I have a listener
 thread that is listening for incoming messages.  Based on those messages,
 I compute stuff, and send the results back.  The trouble I'm having is
 that the listening thread is set up as blocking, and when I have the
 results ready, I want to unblock it, rather than waiting for it to
 timeout, and send the results immediately.  Is there a way to cancel the
 timeout on the listening thread's libwebsocket_servce call, and free
 libwebsocket to turn its efforts to the transmitting protocol, to send
 results immediately when they are ready?

 For what its worth, I am protecting lots of things with mutexes,
 acknowledging the non-thread-safe-ness of libwebsockets and trying to keep
 any thread from colliding with any other.  If you had some notion of what
 libwebsocket calls I need to protect, that'd be also quite useful.

 Thanks for any guidance you can provide.
 Dave

--
Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/56>
libwebsockets <http://libwebsockets.org>
libwebsockets C library



More information about the Libwebsockets mailing list