Lines Matching refs:tctx

125   ThreadContextBase *tctx = QuarantinePop();  in CreateThread()  local
126 if (tctx) { in CreateThread()
127 tid = tctx->tid; in CreateThread()
131 tctx = context_factory_(tid); in CreateThread()
132 threads_[tid] = tctx; in CreateThread()
143 CHECK_NE(tctx, 0); in CreateThread()
146 CHECK_EQ(tctx->status, ThreadStatusInvalid); in CreateThread()
152 tctx->SetCreated(user_id, total_threads_++, detached, in CreateThread()
161 ThreadContextBase *tctx = threads_[tid]; in RunCallbackForEachThreadLocked() local
162 if (tctx == 0) in RunCallbackForEachThreadLocked()
164 cb(tctx, arg); in RunCallbackForEachThreadLocked()
171 ThreadContextBase *tctx = threads_[tid]; in FindThread() local
172 if (tctx != 0 && cb(tctx, arg)) in FindThread()
173 return tctx->tid; in FindThread()
182 ThreadContextBase *tctx = threads_[tid]; in FindThreadContextLocked() local
183 if (tctx != 0 && cb(tctx, arg)) in FindThreadContextLocked()
184 return tctx; in FindThreadContextLocked()
189 static bool FindThreadContextByOsIdCallback(ThreadContextBase *tctx, in FindThreadContextByOsIdCallback() argument
191 return (tctx->os_id == (uptr)arg && tctx->status != ThreadStatusInvalid && in FindThreadContextByOsIdCallback()
192 tctx->status != ThreadStatusDead); in FindThreadContextByOsIdCallback()
203 ThreadContextBase *tctx = threads_[tid]; in SetThreadName() local
204 CHECK_NE(tctx, 0); in SetThreadName()
205 CHECK_EQ(ThreadStatusRunning, tctx->status); in SetThreadName()
206 tctx->SetName(name); in SetThreadName()
212 ThreadContextBase *tctx = threads_[tid]; in SetThreadNameByUserId() local
213 if (tctx != 0 && tctx->user_id == user_id && in SetThreadNameByUserId()
214 tctx->status != ThreadStatusInvalid) { in SetThreadNameByUserId()
215 tctx->SetName(name); in SetThreadNameByUserId()
224 ThreadContextBase *tctx = threads_[tid]; in DetachThread() local
225 CHECK_NE(tctx, 0); in DetachThread()
226 if (tctx->status == ThreadStatusInvalid) { in DetachThread()
230 tctx->OnDetached(arg); in DetachThread()
231 if (tctx->status == ThreadStatusFinished) { in DetachThread()
232 tctx->SetDead(); in DetachThread()
233 QuarantinePush(tctx); in DetachThread()
235 tctx->detached = true; in DetachThread()
242 ThreadContextBase *tctx = threads_[tid]; in JoinThread() local
243 CHECK_NE(tctx, 0); in JoinThread()
244 if (tctx->status == ThreadStatusInvalid) { in JoinThread()
248 tctx->SetJoined(arg); in JoinThread()
249 QuarantinePush(tctx); in JoinThread()
259 ThreadContextBase *tctx = threads_[tid]; in FinishThread() local
260 CHECK_NE(tctx, 0); in FinishThread()
261 CHECK_EQ(ThreadStatusRunning, tctx->status); in FinishThread()
262 tctx->SetFinished(); in FinishThread()
263 if (tctx->detached) { in FinishThread()
264 tctx->SetDead(); in FinishThread()
265 QuarantinePush(tctx); in FinishThread()
273 ThreadContextBase *tctx = threads_[tid]; in StartThread() local
274 CHECK_NE(tctx, 0); in StartThread()
275 CHECK_EQ(ThreadStatusCreated, tctx->status); in StartThread()
276 tctx->SetStarted(os_id, arg); in StartThread()
279 void ThreadRegistry::QuarantinePush(ThreadContextBase *tctx) { in QuarantinePush() argument
280 if (tctx->tid == 0) in QuarantinePush()
282 dead_threads_.push_back(tctx); in QuarantinePush()
285 tctx = dead_threads_.front(); in QuarantinePush()
287 CHECK_EQ(tctx->status, ThreadStatusDead); in QuarantinePush()
288 tctx->Reset(); in QuarantinePush()
289 tctx->reuse_count++; in QuarantinePush()
290 if (max_reuse_ > 0 && tctx->reuse_count >= max_reuse_) in QuarantinePush()
292 invalid_threads_.push_back(tctx); in QuarantinePush()
298 ThreadContextBase *tctx = invalid_threads_.front(); in QuarantinePop() local
300 return tctx; in QuarantinePop()