Lines Matching full:thread
47 /* Suspend a thread: */
49 _pthread_suspend_np(pthread_t thread)
54 /* Suspending the current thread doesn't make sense. */
55 if (thread == _get_curthread())
58 /* Add a reference to the thread: */
59 else if ((ret = _thr_ref_add(curthread, thread, /*include dead*/0))
62 THR_THREAD_LOCK(curthread, thread);
63 suspend_common(curthread, thread, 1);
65 THR_THREAD_UNLOCK(curthread, thread);
68 _thr_ref_delete(curthread, thread);
108 struct pthread *thread;
116 TAILQ_FOREACH(thread, &_thread_list, tle) {
117 if (thread != curthread) {
118 THR_THREAD_LOCK(curthread, thread);
119 if (thread->state != PS_DEAD &&
120 !(thread->flags & THR_FLAGS_SUSPENDED))
121 thread->flags |= THR_FLAGS_NEED_SUSPEND;
122 THR_THREAD_UNLOCK(curthread, thread);
128 TAILQ_FOREACH(thread, &_thread_list, tle) {
129 if (thread != curthread) {
130 /* First try to suspend the thread without waiting */
131 THR_THREAD_LOCK(curthread, thread);
132 ret = suspend_common(curthread, thread, 0);
136 THR_REF_ADD(curthread, thread);
137 suspend_common(curthread, thread, 1);
138 THR_REF_DEL(curthread, thread);
139 _thr_try_gc(curthread, thread);
140 /* thread lock released */
150 THR_THREAD_UNLOCK(curthread, thread);
160 suspend_common(struct pthread *curthread, struct pthread *thread,
165 while (thread->state != PS_DEAD &&
166 !(thread->flags & THR_FLAGS_SUSPENDED)) {
167 thread->flags |= THR_FLAGS_NEED_SUSPEND;
168 /* Thread is in creation. */
169 if (thread->tid == TID_TERMINATED)
171 tmp = thread->cycle;
172 _thr_send_sig(thread, SIGCANCEL);
173 THR_THREAD_UNLOCK(curthread, thread);
175 _thr_umtx_wait_uint(&thread->cycle, tmp, NULL, 0);
176 THR_THREAD_LOCK(curthread, thread);
178 THR_THREAD_LOCK(curthread, thread);