mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Implement join with timeout (and detach).
Under certain situations (notably JNI shutdown), it's possible to get deadlock when using thread join(). To avoid this, implement a timeout. Normally we try to simply join the thread, but if it times out, we detach the thread instead.
This commit is contained in:
@@ -79,6 +79,9 @@ class RpcServer {
|
||||
m_response_map;
|
||||
|
||||
std::thread m_thread;
|
||||
std::mutex m_shutdown_mutex;
|
||||
std::condition_variable m_shutdown_cv;
|
||||
bool m_shutdown = false;
|
||||
|
||||
ATOMIC_STATIC_DECL(RpcServer)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user