Lines Matching refs:thread
132 * pointer to the thread data, it is safe to change the mapping from
133 * stack pointer to thread data afterwards.
202 * gets to run, for various things that use the state of the initial thread
203 * to work properly (thread-specific data is an application-visible example;
261 /* Create the thread structure corresponding to main() */
305 /* General-purpose thread data structure sanitization. */
406 pthread_create(pthread_t *thread, const pthread_attr_t *attr,
420 return __libc_thr_create_stub(thread, attr, startfunc, arg);
439 * _lwp_unpark from another thread pending in the
448 * For the very first thread, before pthread__started
470 * Try to reclaim a dead thread.
519 /* Will be reset by the thread upon exit. */
571 *thread = newthread;
590 * thread register or decent thread local storage.
614 pthread_suspend_np(pthread_t thread)
618 pthread__error(EINVAL, "Invalid thread",
619 thread->pt_magic == PT_MAGIC);
622 if (self == thread) {
625 if (pthread__find(thread) != 0)
627 if (_lwp_suspend(thread->pt_lid) == 0)
633 pthread_resume_np(pthread_t thread)
636 pthread__error(EINVAL, "Invalid thread",
637 thread->pt_magic == PT_MAGIC);
639 if (pthread__find(thread) != 0)
641 if (_lwp_continue(thread->pt_lid) == 0)
673 /* Perform cleanup of thread-specific data */
704 pthread_join(pthread_t thread, void **valptr)
708 pthread__error(EINVAL, "Invalid thread",
709 thread->pt_magic == PT_MAGIC);
713 if (pthread__find(thread) != 0)
716 if (thread == self)
722 if (_lwp_wait(thread->pt_lid, NULL) == 0)
732 pthread_mutex_lock(&thread->pt_lock);
733 if (thread->pt_state != PT_STATE_ZOMBIE) {
738 *valptr = thread->pt_exitval;
741 pthread__reap(thread);
746 pthread__reap(pthread_t thread)
750 name = thread->pt_name;
751 thread->pt_name = NULL;
752 thread->pt_state = PT_STATE_DEAD;
753 pthread_mutex_unlock(&thread->pt_lock);
756 PTQ_INSERT_HEAD(&pthread__deadqueue, thread, pt_deadq);
770 pthread__error(0, "Invalid thread",
773 pthread__error(0, "Invalid thread",
782 pthread_detach(pthread_t thread)
786 pthread__error(EINVAL, "Invalid thread",
787 thread->pt_magic == PT_MAGIC);
789 if (pthread__find(thread) != 0)
792 pthread_mutex_lock(&thread->pt_lock);
793 if ((thread->pt_flags & PT_FLAG_DETACHED) != 0) {
796 error = _lwp_detach(thread->pt_lid);
798 thread->pt_flags |= PT_FLAG_DETACHED;
802 if (thread->pt_state == PT_STATE_ZOMBIE) {
804 pthread__reap(thread);
806 pthread_mutex_unlock(&thread->pt_lock);
812 pthread_getname_np(pthread_t thread, char *name, size_t len)
815 pthread__error(EINVAL, "Invalid thread",
816 thread->pt_magic == PT_MAGIC);
818 if (pthread__find(thread) != 0)
821 pthread_mutex_lock(&thread->pt_lock);
822 if (thread->pt_name == NULL)
825 strlcpy(name, thread->pt_name, len);
826 pthread_mutex_unlock(&thread->pt_lock);
833 pthread_setname_np(pthread_t thread, const char *name, void *arg)
838 pthread__error(EINVAL, "Invalid thread",
839 thread->pt_magic == PT_MAGIC);
841 if (pthread__find(thread) != 0)
852 pthread_mutex_lock(&thread->pt_lock);
853 oldname = thread->pt_name;
854 thread->pt_name = cp;
855 (void)_lwp_setname(thread->pt_lid, cp);
856 pthread_mutex_unlock(&thread->pt_lock);
876 pthread_cancel(pthread_t thread)
881 pthread__error(EINVAL, "Invalid thread",
882 thread->pt_magic == PT_MAGIC);
884 if (pthread__find(thread) != 0)
894 old = atomic_load_relaxed(&thread->pt_cancel);
902 &thread->pt_cancel, &old, new,
906 _lwp_wakeup(thread->pt_lid);
1209 * Thread park/unpark operations. The kernel operations are
1233 * o Only the blocking thread (this thread) ever sets it
1237 * must also make this thread return from _lwp_park.
1246 * If we deferred unparking a thread, arrange to
1351 * Set up the slightly special stack for the "initial" thread, which