mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-23 00:00:06 +01:00

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.
27 lines
656 B
Markdown
27 lines
656 B
Markdown
# 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 <loglevel>|Debug verbosity in decimal, eg, -d15
|
|
|