• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/libpthread-105.1.4/src/

Lines Matching refs:thread

91 // pthread (other than the main thread) has been created.
118 // Mach message notification that a thread needs to be recycled.
121 pthread_t thread;
146 static int _pthread_allocate(pthread_t *thread, const pthread_attr_t *attrs, void **stack);
164 static int _pthread_find_thread(pthread_t thread);
205 extern pthread_t __bsdthread_create(void *(*func)(void *), void * func_arg, void * stack, pthread_t thread, unsigned int flags);
226 // Allocate a thread structure, stack and guard page.
228 // The thread structure may optionally be placed in the same allocation as the
235 // The allocated thread structure is initialized with values that indicate how
239 _pthread_allocate(pthread_t *thread, const pthread_attr_t *attrs, void **stack)
251 *thread = NULL;
306 *thread = t;
317 // Don't free the main thread.
324 // Terminates the thread if called from the currently running thread.
351 // Don't free the main thread.
368 PTHREAD_ABORT("thread %p didn't terminate", t);
426 // Default stack size is 512KB; independent of the main thread's stack size.
634 * Create and start execution of a new thread.
670 /* Give the thread a default QoS tier, of zero. */
719 /* Non portable public api to know whether this process has(had) atleast one thread
720 * apart from main thread. There could be race if there is a thread in the process of
721 * creation at the time of call . It does not tell whether there are more than one thread
738 * add this bypass for main thread as it might have exited,
778 // since the main thread will not get de-allocated from underneath us
807 // since the main thread will not get de-allocated from underneath us
864 /* returns non-zero if the current thread is the main thread */
875 the current thread's thread_id. So folks don't have to call
880 pthread_threadid_np(pthread_t thread, uint64_t *thread_id)
889 if (thread == NULL || thread == self) {
893 res = _pthread_find_thread(thread);
895 *thread_id = thread->thread_id;
903 pthread_getname_np(pthread_t thread, char *threadname, size_t len)
907 if (thread == NULL) {
912 res = _pthread_find_thread(thread);
914 strlcpy(threadname, thread->pthread_name, len);
953 // The parent and child threads race to add the thread to the list.
968 // the thread structure memory alive so our dereferences above
969 // are valid. If it's a detached thread, then no joiner will
970 // deallocate the thread structure itself. So we do it here.
1005 // Returns EBUSY if the thread structure should be kept alive (is joinable).
1006 // Returns ESRCH if the thread structure is no longer valid (was detached).
1017 // When a thread removes itself:
1018 // - Set the childexit flag indicating that the thread has exited.
1020 // - If the thread is joinable, keep it on the list so that
1022 // thread count so that we exit if no threads are running.
1023 // - Update the running thread count.
1024 // When another thread removes a joinable thread:
1025 // - CAREFUL not to dereference the thread before verifying that the
1027 // - Remove the thread from the list.
1042 // If we found a thread but it's not joinable, bail.
1059 pthread_create(pthread_t *thread,
1092 // kernel will allocate thread and stack, pass stacksize.
1095 // allocate the thread and its stack
1112 // free the thread and stack if we allocated it
1123 // XXX if a thread is created detached and exits, t will be invalid
1124 *thread = t;
1129 pthread_create_suspended_np(pthread_t *thread,
1151 *thread = t;
1170 // Set up a suspended thread.
1176 pthread_detach(pthread_t thread)
1182 res = _pthread_lookup_thread(thread, NULL, 1);
1184 return res; // Not a valid thread to detach.
1187 LOCK(thread->lock);
1188 if (thread->detached & PTHREAD_CREATE_JOINABLE) {
1189 if (thread->detached & _PTHREAD_EXITED) {
1190 // Join the thread if it's already exited.
1193 thread->detached &= ~PTHREAD_CREATE_JOINABLE;
1194 thread->detached |= PTHREAD_CREATE_DETACHED;
1195 sema = thread->joiner_notify;
1200 UNLOCK(thread->lock);
1203 pthread_join(thread, NULL);
1220 return ESRCH; // Not a valid thread.
1269 * Terminate a thread.
1301 // Clear per-thread semaphore cache
1319 pthread_getschedparam(pthread_t thread,
1325 if (thread == NULL) {
1331 ret = _pthread_find_thread(thread);
1334 *policy = thread->policy;
1337 *param = thread->param;
1347 pthread_setschedparam_internal(pthread_t thread,
1389 // since the main thread will not get de-allocated from underneath us
1400 // Ensure the thread is still valid.
1483 _pthread_testcancel(pthread_t thread, int isconforming)
1487 LOCK(thread->lock);
1488 bool canceled = ((thread->cancel_state & flags) == flags);
1489 UNLOCK(thread->lock);
1588 // Set up the main thread structure
1599 pthread_t thread = &_thread;
1601 _pthread_struct_init(thread, &_pthread_attr_default, stackaddr, stacksize, 0);
1602 thread->detached = PTHREAD_CREATE_JOINABLE;
1607 // Finishes initialization of main thread attributes.
1608 // Initializes the thread list and add the main thread.
1609 // Calls _pthread_set_self() to prepare the main thread for execution.
1610 __pthread_fork_child_internal(thread);
1631 // Re-use the main thread's static storage if no thread was provided.
1648 // Initialize the list of threads with the new main thread.
1657 * Query/update the cancelability 'state' of a thread
1693 /* When a thread exits set the cancellation state to DISABLE and DEFERRED */
1709 _pthread_join_cleanup(pthread_t thread, void ** value_ptr, int conforming)
1711 // Returns ESRCH if the thread was not created joinable.
1712 int ret = __pthread_remove_thread(thread, false, NULL);
1718 *value_ptr = __pthread_get_exit_value(thread, conforming);
1720 _pthread_introspection_thread_destroy(thread);
1721 _pthread_deallocate(thread);
1727 _pthread_find_thread(pthread_t thread)
1729 if (thread != NULL) {
1733 if (p == thread) {
1734 if (_pthread_kernel_thread(thread) == MACH_PORT_NULL) {
1748 _pthread_lookup_thread(pthread_t thread, mach_port_t *portp, int only_joinable)
1753 if (thread == NULL) {
1759 ret = _pthread_find_thread(thread);
1761 // Fail if we only want joinable threads and the thread found is
1763 if (only_joinable != 0 && (thread->detached & PTHREAD_CREATE_DETACHED) != 0) {
1766 kport = _pthread_kernel_thread(thread);
1783 /* Clear the current thread's TSD, that can be done inline. */
1856 // New thread created by kernel, needs initialization.
1862 // Not a joinable thread.
1866 // Update the running thread count and set childrun bit.
1873 // set this thread to have the QoS class provided to use by the kernel
1889 /* Old thread priorities are inverted from where we have them in
1918 /* B&I builders can't pass a QOS_CLASS_DEFAULT thread to dispatch, for fear of the QoS being
1920 * make this thread look like QOS_CLASS_USER_INITIATED even though it will still run as legacy.
1938 /* "New" API, where dispatch is expecting to be given the thread priority */