dhbaird / easywsclient

A short and sweet WebSocket client for C++
MIT License
745 stars 205 forks source link

Added interrupt() function to break out of poll() before timeout #88

Open FigBug opened 5 years ago

FigBug commented 5 years ago

Using a long timeout for polling is good to reduce CPU usage and wakeups. But then sending messages is delayed until poll returns since they must be done from same thread. So added function interrupt() that can cancel poll from another thread, then you can check for outgoing messages and send them (or shutdown your program without having to wait for poll)