@@ -354,28 +354,29 @@ namespace NActors {
354
354
}
355
355
356
356
void TBasicExecutorPool::ScheduleActivationExLocalQueue (TMailbox* mailbox, ui64 revolvingWriteCounter) {
357
- if (TlsThreadContext && TlsThreadContext->Pool () == this && TlsThreadContext->WorkerId () >= 0 ) {
357
+ if (TlsThreadContext && TlsThreadContext->Pool () == this ) {
358
+ TWorkerId workerId = TlsThreadContext->WorkerId ();
358
359
if (++TlsThreadContext->LocalQueueContext .WriteTurn < TlsThreadContext->LocalQueueContext .LocalQueueSize ) {
359
- LocalQueues[TlsThreadContext-> WorkerId () ].push (mailbox->Hint );
360
+ LocalQueues[workerId ].push (mailbox->Hint );
360
361
return ;
361
362
}
362
363
if (ActorSystemProfile != EASProfile::Default) {
363
364
TAtomic x = AtomicGet (Semaphore);
364
365
TSemaphore semaphore = TSemaphore::GetSemaphore (x);
365
366
if constexpr (NFeatures::TLocalQueuesFeatureFlags::UseIfAllOtherThreadsAreSleeping) {
366
367
if (semaphore.CurrentSleepThreadCount == semaphore.CurrentThreadCount - 1 && semaphore.OldSemaphore == 0 ) {
367
- if (LocalQueues[TlsThreadContext-> WorkerId () ].empty ()) {
368
- LocalQueues[TlsThreadContext-> WorkerId () ].push (mailbox->Hint );
368
+ if (LocalQueues[workerId ].empty ()) {
369
+ LocalQueues[workerId ].push (mailbox->Hint );
369
370
return ;
370
371
}
371
372
}
372
373
}
373
374
374
375
if constexpr (NFeatures::TLocalQueuesFeatureFlags::UseOnMicroburst) {
375
376
if (semaphore.OldSemaphore >= semaphore.CurrentThreadCount ) {
376
- if (LocalQueues[TlsThreadContext-> WorkerId () ].empty () && TlsThreadContext->LocalQueueContext .WriteTurn < 1 ) {
377
+ if (LocalQueues[workerId ].empty () && TlsThreadContext->LocalQueueContext .WriteTurn < 1 ) {
377
378
TlsThreadContext->LocalQueueContext .WriteTurn ++;
378
- LocalQueues[TlsThreadContext-> WorkerId () ].push (mailbox->Hint );
379
+ LocalQueues[workerId ].push (mailbox->Hint );
379
380
return ;
380
381
}
381
382
}
@@ -519,8 +520,8 @@ namespace NActors {
519
520
if (deadline < current)
520
521
deadline = current;
521
522
522
- if (auto sharedPool = TlsThreadContext->SharedPool ()) {
523
- sharedPool ->Schedule (deadline, ev, cookie, workerId);
523
+ if (TlsThreadContext && TlsThreadContext->IsShared ()) {
524
+ TlsThreadContext-> SharedPool () ->Schedule (deadline, ev, cookie, workerId);
524
525
} else {
525
526
Y_DEBUG_ABORT_UNLESS (workerId < MaxFullThreadCount);
526
527
ScheduleWriters[workerId].Push (deadline.MicroSeconds (), ev.Release (), cookie);
@@ -529,8 +530,8 @@ namespace NActors {
529
530
530
531
void TBasicExecutorPool::Schedule (TDuration delta, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) {
531
532
const auto deadline = ActorSystem->Monotonic () + delta;
532
- if (auto sharedPool = TlsThreadContext->SharedPool ()) {
533
- sharedPool ->Schedule (deadline, ev, cookie, workerId);
533
+ if (TlsThreadContext && TlsThreadContext->IsShared ()) {
534
+ TlsThreadContext-> SharedPool () ->Schedule (deadline, ev, cookie, workerId);
534
535
} else {
535
536
Y_DEBUG_ABORT_UNLESS (workerId < MaxFullThreadCount);
536
537
ScheduleWriters[workerId].Push (deadline.MicroSeconds (), ev.Release (), cookie);
0 commit comments