diff options
author | alexvru <alexvru@ydb.tech> | 2023-03-27 16:43:28 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2023-03-27 16:43:28 +0300 |
commit | 773aa8b4c48879485bc7cbaa6995d68a574530a1 (patch) | |
tree | e5cc3a7d8b0ce299ed8f6e2f423f9c0f149675cf /library | |
parent | 728860f3dcbfa5715bcea78401a55d22e6b24b04 (diff) | |
download | ydb-773aa8b4c48879485bc7cbaa6995d68a574530a1.tar.gz |
Fix asan problem with coro tx
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/actors/core/actor.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h index 8330d860c8..5e04c0f2ab 100644 --- a/library/cpp/actors/core/actor.h +++ b/library/cpp/actors/core/actor.h @@ -468,20 +468,24 @@ namespace NActors { // must be called to wrap any call trasitions from one actor to another template<typename TActor, typename TMethod, typename... TArgs> - static decltype((std::declval<TActor>().*std::declval<TMethod>())(std::declval<TArgs>()...)) - InvokeOtherActor(TActor& actor, TMethod&& method, TArgs&&... args) { - struct TRecurseContext: TActorContext { - TActivationContext* Prev; + static std::invoke_result_t<TMethod, TActor, TArgs...> InvokeOtherActor(TActor& actor, TMethod&& method, TArgs&&... args) { + struct TRecurseContext : TActorContext { + TActivationContext* const Prev; + TRecurseContext(const TActorId& actorId) : TActorContext(TActivationContext::ActorContextFor(actorId)) - , Prev(TlsActivationContext) { + , Prev(TlsActivationContext) + { TlsActivationContext = this; } + ~TRecurseContext() { + Y_VERIFY(TlsActivationContext == this, "TlsActivationContext mismatch; probably InvokeOtherActor was invoked from a coroutine"); TlsActivationContext = Prev; } } context(actor.SelfId()); - return (actor.*method)(std::forward<TArgs>(args)...); + + return std::invoke(std::forward<TMethod>(method), actor, std::forward<TArgs>(args)...); } virtual void Registered(TActorSystem* sys, const TActorId& owner); |