Exemple #1
0
static void
pshared_unlock(struct pthread *curthread)
{

    _thr_rwl_unlock(&pshared_lock);
    curthread->locklevel--;
    _thr_ast(curthread);
}
Exemple #2
0
static void
thread_start(struct pthread *curthread)
{
	sigset_t set;

	if (curthread->attr.suspend == THR_CREATE_SUSPENDED)
		set = curthread->sigmask;

	/*
	 * This is used as a serialization point to allow parent
	 * to report 'new thread' event to debugger or tweak new thread's
	 * attributes before the new thread does real-world work.
	 */
	THR_LOCK(curthread);
	THR_UNLOCK(curthread);

	if (curthread->force_exit)
		_pthread_exit(PTHREAD_CANCELED);

	if (curthread->attr.suspend == THR_CREATE_SUSPENDED) {
#if 0
		/* Done in THR_UNLOCK() */
		_thr_ast(curthread);
#endif

		/*
		 * Parent thread have stored signal mask for us,
		 * we should restore it now.
		 */
		__sys_sigprocmask(SIG_SETMASK, &set, NULL);
	}

#ifdef _PTHREAD_FORCED_UNWIND
	curthread->unwind_stackend = (char *)curthread->attr.stackaddr_attr +
		curthread->attr.stacksize_attr;
#endif

	/* Run the current thread's start routine with argument: */
	_pthread_exit(curthread->start_routine(curthread->arg));

	/* This point should never be reached. */
	PANIC("Thread has resumed after exit");
}