1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/secure-streams/minimal-secure-streams-threads/README.md
Andy Green 68d9f3a7f2 ss: wire up EVENT_WAIT_CANCELLED
Currently the lws_cancel_service() api only manifests itself at lws level.
This adds a state LWSSSCS_EVENT_WAIT_CANCELLED that is broadcast to all
SS in the event loop getting the cancel service api call, and allows
SS-level user code to pick up handling events from other threads.

There's a new example minimal-secure-streams-threads which shows the
pattern for other threads to communicate with and trigger the event in the
lws service thread.
2021-04-15 19:10:54 +01:00

656 B

lws minimal secure streams threads

This application creates a thread and calls lws_cancel_service() at 10Hz.

It creates a Secure Stream and checks that it is getting the LWSSSCS_EVENT_WAIT_CANCELLED state for each lws_cancel_service().

It also demonstrates how to protect a shared data area between the thread(s) and the lws event loop thread to put data there that describes what the thread wants the service loop to do.

It exits after 3s with a 0 return code if the SS saw the expected amount of messages.

build

 $ cmake . && make

usage

Commandline option Meaning
-d Debug verbosity in decimal, eg, -d15