Drop context for SemaphoreActor before creation of the actor.
This commit is contained in:
parent
e8b0983d7b
commit
061c4f65d5
|
@ -69,11 +69,6 @@ class SemaphoreActor final : public Actor {
|
||||||
size_t capacity_;
|
size_t capacity_;
|
||||||
VectorQueue<Promise<Promise<Unit>>> pending_;
|
VectorQueue<Promise<Promise<Unit>>> pending_;
|
||||||
|
|
||||||
void start_up() final {
|
|
||||||
set_context(std::make_shared<ActorContext>());
|
|
||||||
set_tag(string());
|
|
||||||
}
|
|
||||||
|
|
||||||
void finish(Result<Unit>) {
|
void finish(Result<Unit>) {
|
||||||
capacity_++;
|
capacity_++;
|
||||||
if (!pending_.empty()) {
|
if (!pending_.empty()) {
|
||||||
|
@ -137,7 +132,11 @@ class GenAuthKeyActor final : public Actor {
|
||||||
|
|
||||||
static TD_THREAD_LOCAL Semaphore *semaphore_;
|
static TD_THREAD_LOCAL Semaphore *semaphore_;
|
||||||
Semaphore &get_handshake_semaphore() {
|
Semaphore &get_handshake_semaphore() {
|
||||||
|
auto old_context = set_context(std::make_shared<ActorContext>());
|
||||||
|
auto old_tag = set_tag(string());
|
||||||
init_thread_local<Semaphore>(semaphore_, 50);
|
init_thread_local<Semaphore>(semaphore_, 50);
|
||||||
|
set_context(std::move(old_context));
|
||||||
|
set_tag(std::move(old_tag));
|
||||||
return *semaphore_;
|
return *semaphore_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user