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

Trac trac at libwebsockets.org
Thu Feb 27 00:12:44 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   |    Version:
  apps                           |   Keywords:  block blocking thread async
Resolution:                      |
---------------------------------+-----------------------------------------

Comment (by agreen):

 If you define LWS_HAS_PPOLL while building the library, ppoll instead of
 poll will be used and if lws sees you are changing fd wait flags during
 the time it is waiting in service it will automatically fire a SIGUSR2 to
 interrupt the ppoll() and expedite waiting on the new flags.

 That usually translates to something happened in another thread while the
 service thread is idle; you did a libwebsocket_callback_on_writable(), and
 instead of having to wait out the timeout before that will get seen by
 [p]poll(), the signal will stop the old ppoll() and restart it with the
 new wait flags.

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



More information about the Libwebsockets mailing list