Lines Matching refs:slot
152 bool attached = tctx->thr && tctx->thr->slot; in DoResetImpl()
181 if (tctx->thr && !tctx->thr->slot) { in DoResetImpl()
193 for (auto& slot : ctx->slots) { in DoResetImpl() local
194 slot.SetEpoch(kEpochZero); in DoResetImpl()
195 slot.journal.Reset(); in DoResetImpl()
196 slot.thr = nullptr; in DoResetImpl()
197 ctx->slot_queue.PushBack(&slot); in DoResetImpl()
234 for (auto& slot : ctx->slots) { in DoReset() local
235 slot.mtx.Lock(); in DoReset()
240 CHECK_EQ(slot.sid, 0); in DoReset()
241 slot.mtx.Unlock(); in DoReset()
247 for (auto& slot : ctx->slots) slot.mtx.Unlock(); in DoReset() local
253 SANITIZER_ACQUIRE(thr->slot->mtx) SANITIZER_NO_THREAD_SAFETY_ANALYSIS { in FindSlotAndLock()
254 CHECK(!thr->slot); in FindSlotAndLock()
255 TidSlot* slot = nullptr; in FindSlotAndLock() local
261 if (slot) { in FindSlotAndLock()
263 if (ctx->slot_queue.Queued(slot)) in FindSlotAndLock()
264 ctx->slot_queue.Remove(slot); in FindSlotAndLock()
266 slot->mtx.Unlock(); in FindSlotAndLock()
269 slot = ctx->slot_queue.PopFront(); in FindSlotAndLock()
270 if (!slot) in FindSlotAndLock()
272 if (slot->epoch() != kEpochLast) { in FindSlotAndLock()
273 ctx->slot_queue.PushBack(slot); in FindSlotAndLock()
278 if (!slot) { in FindSlotAndLock()
282 slot->mtx.Lock(); in FindSlotAndLock()
285 if (slot->thr) { in FindSlotAndLock()
286 DPrintf("#%d: preempting sid=%d tid=%d\n", thr->tid, (u32)slot->sid, in FindSlotAndLock()
287 slot->thr->tid); in FindSlotAndLock()
288 slot->SetEpoch(slot->thr->fast_state.epoch()); in FindSlotAndLock()
289 slot->thr = nullptr; in FindSlotAndLock()
291 if (slot->epoch() != kEpochLast) in FindSlotAndLock()
292 return slot; in FindSlotAndLock()
297 TidSlot* slot = FindSlotAndLock(thr); in SlotAttachAndLock() local
298 DPrintf("#%d: SlotAttach: slot=%u\n", thr->tid, static_cast<int>(slot->sid)); in SlotAttachAndLock()
299 CHECK(!slot->thr); in SlotAttachAndLock()
300 CHECK(!thr->slot); in SlotAttachAndLock()
301 slot->thr = thr; in SlotAttachAndLock()
302 thr->slot = slot; in SlotAttachAndLock()
303 Epoch epoch = EpochInc(slot->epoch()); in SlotAttachAndLock()
305 slot->SetEpoch(epoch); in SlotAttachAndLock()
306 thr->fast_state.SetSid(slot->sid); in SlotAttachAndLock()
316 thr->clock.Set(slot->sid, epoch); in SlotAttachAndLock()
317 slot->journal.PushBack({thr->tid, epoch}); in SlotAttachAndLock()
321 TidSlot* slot = thr->slot; in SlotDetachImpl() local
322 thr->slot = nullptr; in SlotDetachImpl()
323 if (thr != slot->thr) { in SlotDetachImpl()
324 slot = nullptr; // we don't own the slot anymore in SlotDetachImpl()
348 slot->SetEpoch(thr->fast_state.epoch()); in SlotDetachImpl()
349 slot->thr = nullptr; in SlotDetachImpl()
353 Lock lock(&thr->slot->mtx); in SlotDetach()
366 TidSlot* slot = thr->slot; in SlotLock() local
367 slot->mtx.Lock(); in SlotLock()
369 if (LIKELY(thr == slot->thr && thr->fast_state.epoch() != kEpochLast)) in SlotLock()
373 slot->mtx.Unlock(); in SlotLock()
380 thr->slot->mtx.Unlock(); in SlotUnlock()
397 TidSlot* slot = &slots[i]; local
398 slot->sid = static_cast<Sid>(i);
399 slot_queue.PushBack(slot);
813 for (auto& slot : ctx->slots) slot.mtx.Lock(); in ForkBefore() local
846 for (auto& slot : ctx->slots) slot.mtx.Unlock(); in ForkAfter() local
1025 if (ctx->slot_queue.Queued(thr->slot)) { in TraceSwitchPartImpl()
1026 ctx->slot_queue.Remove(thr->slot); in TraceSwitchPartImpl()
1027 ctx->slot_queue.PushBack(thr->slot); in TraceSwitchPartImpl()