- thread_tid(thread), thread->state, 0, 0, 0);
-
- /*
- * Check that the thread is not bound
- * to a different processor, and that realtime
- * is not involved.
- *
- * Next, pull it off its run queue. If it
- * doesn't come, it's not eligible.
- */
- processor = current_processor();
- if (processor->current_pri < BASEPRI_RTQUEUES &&
- thread->sched_pri < BASEPRI_RTQUEUES &&
- (thread->bound_processor == PROCESSOR_NULL ||
- thread->bound_processor == processor) &&
- thread_run_queue_remove(thread) ) {
- /*
- * Hah, got it!!
- */
- thread_unlock(thread);
-
- (void)thread_deallocate_internal(thread);
+ thread_tid(thread), thread->state,
+ pulled_thread ? TRUE : FALSE, 0, 0);
+
+ if (pulled_thread != THREAD_NULL) {
+ /* We can't be dropping the last ref here */
+ thread_deallocate_safe(thread);