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.
204 * gets to run, for various things that use the state of the initial thread
205 * to work properly (thread-specific data is an application-visible example;
263 /* Create the thread structure corresponding to main() */
307 /* General-purpose thread data structure sanitization. */
408 pthread_create(pthread_t *thread, const pthread_attr_t *attr,
422 return __libc_thr_create_stub(thread, attr, startfunc, arg);
441 * _lwp_unpark from another thread pending in the
450 * For the very first thread, before pthread__started
472 * Try to reclaim a dead thread.
521 /* Will be reset by the thread upon exit. */
573 *thread = newthread;
592 * thread register or decent thread local storage.
616 pthread_suspend_np(pthread_t thread)
620 pthread__error(EINVAL, "Invalid thread",
621 thread->pt_magic == PT_MAGIC);
624 if (self == thread) {
627 if (pthread__find(thread) != 0)
629 if (_lwp_suspend(thread->pt_lid) == 0)
635 pthread_resume_np(pthread_t thread)
638 pthread__error(EINVAL, "Invalid thread",
639 thread->pt_magic == PT_MAGIC);
641 if (pthread__find(thread) != 0)
643 if (_lwp_continue(thread->pt_lid) == 0)
675 /* Perform cleanup of thread-specific data */
706 pthread_join(pthread_t thread, void **valptr)
710 pthread__error(EINVAL, "Invalid thread",
711 thread->pt_magic == PT_MAGIC);
715 if (pthread__find(thread) != 0)
718 if (thread == self)
724 if (_lwp_wait(thread->pt_lid, NULL) == 0)
734 pthread_mutex_lock(&thread->pt_lock);
735 if (thread->pt_state != PT_STATE_ZOMBIE) {
740 *valptr = thread->pt_exitval;
743 pthread__reap(thread);
748 pthread__reap(pthread_t thread)
752 name = thread->pt_name;
753 thread->pt_name = NULL;
754 thread->pt_state = PT_STATE_DEAD;
755 pthread_mutex_unlock(&thread->pt_lock);
758 PTQ_INSERT_HEAD(&pthread__deadqueue, thread, pt_deadq);
772 pthread__error(0, "Invalid thread",
775 pthread__error(0, "Invalid thread",
784 pthread_detach(pthread_t thread)
788 pthread__error(EINVAL, "Invalid thread",
789 thread->pt_magic == PT_MAGIC);
791 if (pthread__find(thread) != 0)
794 pthread_mutex_lock(&thread->pt_lock);
795 if ((thread->pt_flags & PT_FLAG_DETACHED) != 0) {
798 error = _lwp_detach(thread->pt_lid);
800 thread->pt_flags |= PT_FLAG_DETACHED;
804 if (thread->pt_state == PT_STATE_ZOMBIE) {
806 pthread__reap(thread);
808 pthread_mutex_unlock(&thread->pt_lock);
814 pthread_getname_np(pthread_t thread, char *name, size_t len)
817 pthread__error(EINVAL, "Invalid thread",
818 thread->pt_magic == PT_MAGIC);
820 if (pthread__find(thread) != 0)
823 pthread_mutex_lock(&thread->pt_lock);
824 if (thread->pt_name == NULL)
827 strlcpy(name, thread->pt_name, len);
828 pthread_mutex_unlock(&thread->pt_lock);
835 pthread_setname_np(pthread_t thread, const char *name, void *arg)
840 pthread__error(EINVAL, "Invalid thread",
841 thread->pt_magic == PT_MAGIC);
843 if (pthread__find(thread) != 0)
854 pthread_mutex_lock(&thread->pt_lock);
855 oldname = thread->pt_name;
856 thread->pt_name = cp;
857 (void)_lwp_setname(thread->pt_lid, cp);
858 pthread_mutex_unlock(&thread->pt_lock);
878 pthread_cancel(pthread_t thread)
883 pthread__error(EINVAL, "Invalid thread",
884 thread->pt_magic == PT_MAGIC);
886 if (pthread__find(thread) != 0)
896 old = atomic_load_relaxed(&thread->pt_cancel);
904 &thread->pt_cancel, &old, new,
908 _lwp_wakeup(thread->pt_lid);
1235 * o Only the blocking thread (this thread) ever sets it
1239 * must also make this thread return from _lwp_park.
1248 * If we deferred unparking a thread, arrange to
1353 * Set up the slightly special stack for the "initial" thread, which