[Libwebsockets] SIGNAL 6
andy at warmcat.com
Tue May 19 08:16:20 CEST 2020
On 5/19/20 7:06 AM, peks geshkov wrote:
> [Mon May 18 10:51:46:35248 2020] ERROR: BackTrace: 9
> /usr/lib/libwebsockets.so.16(lws_write+0x167) [0x7fbb7d277efb]
> [Mon May 18 10:51:46:35267 2020] ERROR: BackTrace: 10
I assume that's related... you cannot just randomly call lws_write()
from some external code, especially if that code is in its own thread.
[Mon May 18 10:51:46:35406 2020] ERROR: BackTrace: 18
that is not the lws event loop / service thread.
You cannot call any lws api from another thread except lws_cancel_service().
If you want to write, without threads involved, follow what all the
examples do and ask for a callback_on_writable(), then do the write in
the WRITEABLE callback.
If another thread wants to write, lws is explicitly NOT threadsafe
except for one path... the other thread can prepare what you want to
write in a shared buffer somewhere, then call lws_cancel_service() and
pick up the normal flow in your LWS_CALLBACK_EVENT_WAIT_CANCELLED
callback by asking for the write callback.
More information about the Libwebsockets