Fix race condition at the start up of system call dispatcher
There is a possibility that the dispatcher thread is started before its state is initialized which causes it to appear as inactive when it tries to enter the send loop and actually exists early. This is a clear design flaw in the runner class but for the time being this disgusting fix will have to suffice.
This commit is contained in:
parent
06dd822ce9
commit
ac3c136332
|
|
@ -86,6 +86,9 @@ void kvz_rtp::dispatcher::dispatch_runner(kvz_rtp::dispatcher *dispatcher, kvz_r
|
|||
std::unique_lock<std::mutex> lk(m);
|
||||
kvz_rtp::transaction_t *t = nullptr;
|
||||
|
||||
while (!dispatcher->active())
|
||||
;
|
||||
|
||||
while (dispatcher->active()) {
|
||||
if ((t = dispatcher->get_transaction()) == nullptr) {
|
||||
dispatcher->get_cvar().wait(lk);
|
||||
|
|
|
|||
Loading…
Reference in New Issue