Lines Matching refs:thread

105  *	Each thread may be waiting for exactly one event; this event
106 * is set using assert_wait(). That thread may be awakened either
108 * or by directly waking that thread up with clear_wait().
116 * Locks on both the thread and on the hash buckets govern the
119 * bucket must be locked before any thread.
123 * thread or hash bucket locks.
1171 * Insert the current thread into the supplied wait queue
1176 * The waiting thread is assumed locked.
1187 thread_t thread)
1192 if (!wait_queue_assert_possible(thread))
1199 return (thread->wait_result = THREAD_AWAKENED);
1205 * realtime thread, similar in principle to performing
1207 * to run the realtime thread, but without causing the
1210 realtime = (thread->sched_pri >= BASEPRI_REALTIME);
1214 * into account. If the thread is vm priviledged, we stick it at
1218 wait_result = thread_mark_wait_locked(thread, interruptible);
1221 || (thread->options & TH_OPT_VMPRIV)
1223 enqueue_head(&wq->wq_queue, (queue_entry_t) thread);
1225 enqueue_tail(&wq->wq_queue, (queue_entry_t) thread);
1227 thread->wait_event = event;
1228 thread->wait_queue = wq;
1232 if (!timer_call_enter_with_leeway(&thread->wait_timer, NULL,
1234 thread->wait_timer_active++;
1235 thread->wait_timer_is_set = TRUE;
1248 * Insert the current thread into the supplied wait queue
1263 thread_t thread = current_thread();
1267 return (thread->wait_result = THREAD_RESTART);
1271 thread_lock(thread);
1276 thread);
1277 thread_unlock(thread);
1286 * Insert the current thread into the supplied wait queue
1304 thread_t thread = current_thread();
1308 return (thread->wait_result = THREAD_RESTART);
1312 thread_lock(thread);
1316 thread);
1317 thread_unlock(thread);
1326 * Insert the current thread into the supplied wait queue
1340 thread_t thread = current_thread();
1344 return (thread->wait_result = THREAD_RESTART);
1348 thread_lock(thread);
1352 thread);
1353 thread_unlock(thread);
1362 * Insert the current thread into the supplied wait queue
1379 thread_t thread = current_thread();
1383 return (thread->wait_result = THREAD_RESTART);
1387 thread_lock(thread);
1390 thread);
1391 thread_unlock(thread);
1462 * Otherwise, its a thread. If it is waiting on
1531 * For each thread, set it running.
1535 thread_t thread = (thread_t)(void *) dequeue(q);
1536 res = thread_go(thread, result);
1538 thread_unlock(thread);
1616 * Select the best thread off a wait queue that meet the
1623 * a locked thread - if one found
1675 * and we didn't find a thread in the set, then mark it.
1677 * If we later find a thread, there may be a spurious
1698 * Otherwise, its a thread. If it is waiting on
1709 * Checking imp donor bit does not need thread lock or
1711 * thread can not be removed from it without acquiring
1714 * a thread while someone drops importance assertion
1715 * on the that thread.
1758 * Pull a thread off its wait queue and (possibly) unlock
1763 * thread locked
1765 * with the thread still locked.
1770 thread_t thread,
1774 assert(thread->wait_queue == waitq);
1776 remqueue((queue_entry_t)thread );
1777 thread->wait_queue = WAIT_QUEUE_NULL;
1778 thread->wait_event = NO_EVENT64;
1779 thread->at_safe_point = FALSE;
1788 * Look for a thread and remove it from the queues, if
1789 * (and only if) the thread is waiting on the supplied
1803 thread_t thread)
1810 thread_lock(thread);
1812 if ((thread->wait_queue == wq) && (thread->wait_event == event)) {
1813 remqueue((queue_entry_t) thread);
1814 thread->at_safe_point = FALSE;
1815 thread->wait_event = NO_EVENT64;
1816 thread->wait_queue = WAIT_QUEUE_NULL;
1817 /* thread still locked */
1821 thread_unlock(thread);
1824 * The wait_queue associated with the thread may be one of this
1843 thread);
1858 * Select a single thread that is most-eligible to run and set
1859 * set it running. But return the thread locked.
1866 * a pointer to the locked thread that was awakened
1876 thread_t thread;
1880 thread = _wait_queue_select64_one(wq, event);
1884 if (thread) {
1885 res = thread_go(thread, result);
1888 return thread; /* still locked if not NULL */
1895 * Select a single thread that is most-eligible to run and set
1904 * KERN_NOT_WAITING - No thread was waiting <wq,event> pair
1913 thread_t thread;
1917 thread = _wait_queue_select64_one(wq, event);
1921 if (thread) {
1924 res = thread_go(thread, result);
1926 thread_unlock(thread);
1936 * Wakeup the most appropriate thread that is in the specified
1942 * KERN_NOT_WAITING - No thread was waiting <wq,event> pair
1951 thread_t thread;
1960 thread = _wait_queue_select64_one(wq, CAST_DOWN(event64_t,event));
1963 if (thread) {
1966 if (thread->sched_pri < priority) {
1968 set_sched_pri(thread, priority);
1970 thread->was_promoted_on_wakeup = 1;
1971 thread->sched_flags |= TH_SFLAG_PROMOTED;
1974 res = thread_go(thread, result);
1976 thread_unlock(thread);
1988 * Wakeup the most appropriate thread that is in the specified
1994 * KERN_NOT_WAITING - No thread was waiting <wq,event> pair
2002 thread_t thread;
2010 thread = _wait_queue_select64_one(wq, event);
2013 if (thread) {
2016 res = thread_go(thread, result);
2018 thread_unlock(thread);
2031 * Wakeup the particular thread that was specified if and only
2035 * This is much safer than just removing the thread from
2044 * KERN_SUCCESS - the thread was found waiting and awakened
2045 * KERN_NOT_WAITING - the thread was not waiting here
2051 thread_t thread,
2060 * See if the thread was still waiting there. If so, it got
2063 res = _wait_queue_select64_thread(wq, event, thread);
2070 res = thread_go(thread, result);
2072 thread_unlock(thread);
2079 * Wakeup the particular thread that was specified if and only
2083 * This is much safer than just removing the thread from
2092 * KERN_SUCCESS - the thread was found waiting and awakened
2093 * KERN_NOT_WAITING - the thread was not waiting here
2099 thread_t thread,
2111 res = _wait_queue_select64_thread(wq, CAST_DOWN(event64_t,event), thread);
2115 res = thread_go(thread, result);
2117 thread_unlock(thread);
2128 * Wakeup the particular thread that was specified if and only
2132 * This is much safer than just removing the thread from
2140 * KERN_SUCCESS - the thread was found waiting and awakened
2141 * KERN_NOT_WAITING - the thread was not waiting here
2147 thread_t thread,
2159 res = _wait_queue_select64_thread(wq, event, thread);
2163 res = thread_go(thread, result);
2166 thread_unlock(thread);