Do not use ScopeGuard to not unblock Client::receive by exception.
GitOrigin-RevId: e5ae94129923da1ea17688860c9d2295d7775b90
This commit is contained in:
parent
e171c6490f
commit
3717a2b132
@ -16,7 +16,6 @@
|
|||||||
#include "td/utils/port/Fd.h"
|
#include "td/utils/port/Fd.h"
|
||||||
#include "td/utils/port/Poll.h"
|
#include "td/utils/port/Poll.h"
|
||||||
#include "td/utils/port/thread.h"
|
#include "td/utils/port/thread.h"
|
||||||
#include "td/utils/ScopeGuard.h"
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@ -216,10 +215,10 @@ class Client::Impl final {
|
|||||||
Response receive(double timeout) {
|
Response receive(double timeout) {
|
||||||
auto is_locked = receive_lock_.exchange(true);
|
auto is_locked = receive_lock_.exchange(true);
|
||||||
CHECK(!is_locked);
|
CHECK(!is_locked);
|
||||||
SCOPE_EXIT {
|
auto response = receive_unlocked(timeout);
|
||||||
receive_lock_.exchange(false);
|
is_locked = receive_lock_.exchange(false);
|
||||||
};
|
CHECK(is_locked);
|
||||||
return receive_unlocked(timeout);
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Impl(const Impl &) = delete;
|
Impl(const Impl &) = delete;
|
||||||
|
Reference in New Issue
Block a user