IXWebSocket icon indicating copy to clipboard operation
IXWebSocket copied to clipboard

Threading concerns

Open HunterZ opened this issue 1 year ago • 2 comments

Is there some documentation on the threading model for IXWebSocket? I had assumed that my message handler registered via ix::WebSocket::setOnMessageCallback() would only get invoked from a background thread, but my application just deadlocked because IXWebSocket invoked it from the same call stack in which I called ix::WebSocket::send().

Uncertainty around which threads might call my message handler means I'm forced to either use a recursive mutex, or to always have my handler spin up a short-lived thread. Ideally IXWebSocket would never invoke the callback from a user thread, but failing that it would be helpful to at least have documentation on what to expect.

Edit: Forgot to provide proof of deadlock: image

HunterZ avatar Apr 22 '23 04:04 HunterZ