Lines Matching refs:self

275 	ulwp_t *self = curthread;  in trim_stack_cache()  local
276 uberdata_t *udp = self->ul_uberdata; in trim_stack_cache()
281 ASSERT(udp->nthreads <= 1 || MUTEX_OWNED(&udp->link_lock, self)); in trim_stack_cache()
425 ulwp_t *self = curthread; in ulwp_alloc() local
426 uberdata_t *udp = self->ul_uberdata; in ulwp_alloc()
526 ulwp_t *self = curthread; in ulwp_broadcast() local
527 uberdata_t *udp = self->ul_uberdata; in ulwp_broadcast()
529 ASSERT(MUTEX_OWNED(ulwp_mutex(ulwp, udp), self)); in ulwp_broadcast()
540 ulwp_t *self = curthread; in find_lwp() local
541 uberdata_t *udp = self->ul_uberdata; in find_lwp()
545 if (self->ul_lwpid == tid) { in find_lwp()
546 ulwp = self; in find_lwp()
564 ulwp_t *self = curthread; in _thrp_create() local
565 uberdata_t *udp = self->ul_uberdata; in _thrp_create()
577 if (!self->ul_primarymap || self->ul_vfork) in _thrp_create()
611 self->ul_async_safe = 1; in _thrp_create()
614 ulwp->ul_queue_fifo = self->ul_queue_fifo; in _thrp_create()
615 ulwp->ul_cond_wait_defer = self->ul_cond_wait_defer; in _thrp_create()
616 ulwp->ul_error_detection = self->ul_error_detection; in _thrp_create()
617 ulwp->ul_async_safe = self->ul_async_safe; in _thrp_create()
618 ulwp->ul_max_spinners = self->ul_max_spinners; in _thrp_create()
619 ulwp->ul_adaptive_spin = self->ul_adaptive_spin; in _thrp_create()
620 ulwp->ul_queue_spin = self->ul_queue_spin; in _thrp_create()
621 ulwp->ul_door_noreserve = self->ul_door_noreserve; in _thrp_create()
622 ulwp->ul_misaligned = self->ul_misaligned; in _thrp_create()
625 ulwp->ul_policy = self->ul_policy; in _thrp_create()
626 ulwp->ul_pri = (self->ul_epri? self->ul_epri : self->ul_pri); in _thrp_create()
627 ulwp->ul_cid = self->ul_cid; in _thrp_create()
628 ulwp->ul_rtclassid = self->ul_rtclassid; in _thrp_create()
630 ulwp->ul_primarymap = self->ul_primarymap; in _thrp_create()
671 enter_critical(self); in _thrp_create()
672 uc.uc_sigmask = ulwp->ul_sigmask = self->ul_sigmask; in _thrp_create()
675 exit_critical(self); in _thrp_create()
684 self->ul_nocancel = 0; /* cancellation is now possible */ in _thrp_create()
709 if (__td_event_report(self, TD_CREATE, udp)) { in _thrp_create()
710 self->ul_td_evbuf.eventnum = TD_CREATE; in _thrp_create()
711 self->ul_td_evbuf.eventdata = (void *)(uintptr_t)tid; in _thrp_create()
715 exit_critical(self); in _thrp_create()
755 ulwp_t *self = curthread; in _thrp_exit() local
756 uberdata_t *udp = self->ul_uberdata; in _thrp_exit()
759 if (__td_event_report(self, TD_DEATH, udp)) { in _thrp_exit()
760 self->ul_td_evbuf.eventnum = TD_DEATH; in _thrp_exit()
764 ASSERT(self->ul_sigdefer != 0); in _thrp_exit()
768 if (self->ul_usropts & THR_NEW_LWP) in _thrp_exit()
770 if (self->ul_usropts & THR_DAEMON) in _thrp_exit()
794 block_all_signals(self); in _thrp_exit()
796 enter_critical(self); in _thrp_exit()
797 rwl_free(self); in _thrp_exit()
799 ulwp_free(self); in _thrp_exit()
800 (void) ulwp_lock(self, udp); in _thrp_exit()
802 if (self->ul_mapsiz && !self->ul_detached) { in _thrp_exit()
814 if (udp->all_lwps == self) in _thrp_exit()
815 udp->all_lwps = self->ul_forw; in _thrp_exit()
816 if (udp->all_lwps == self) in _thrp_exit()
819 self->ul_forw->ul_back = self->ul_back; in _thrp_exit()
820 self->ul_back->ul_forw = self->ul_forw; in _thrp_exit()
822 self->ul_forw = self->ul_back = NULL; in _thrp_exit()
825 record_spin_locks(self); in _thrp_exit()
827 self->ul_dead = 1; in _thrp_exit()
828 self->ul_pleasestop = 0; in _thrp_exit()
830 int ix = self->ul_ix; /* the hash index */ in _thrp_exit()
831 (void) memcpy(replace, self, REPLACEMENT_SIZE); in _thrp_exit()
836 hash_out_unlocked(self, ix, udp); in _thrp_exit()
838 ASSERT(!(self->ul_detached)); in _thrp_exit()
839 self->ul_detached = 1; /* this frees the stack */ in _thrp_exit()
840 self->ul_schedctl = NULL; in _thrp_exit()
841 self->ul_schedctl_called = &udp->uberflags; in _thrp_exit()
842 set_curthread(self = replace); in _thrp_exit()
848 udp->link_lock.mutex_owner = (uintptr_t)self; in _thrp_exit()
849 ulwp_mutex(self, udp)->mutex_owner = (uintptr_t)self; in _thrp_exit()
864 if (!self->ul_detached) { in _thrp_exit()
868 udp->all_zombies = self->ul_forw = self->ul_back = self; in _thrp_exit()
870 self->ul_forw = udp->all_zombies; in _thrp_exit()
871 self->ul_back = udp->all_zombies->ul_back; in _thrp_exit()
872 self->ul_back->ul_forw = self; in _thrp_exit()
873 self->ul_forw->ul_back = self; in _thrp_exit()
879 ulwp_broadcast(self); in _thrp_exit()
880 (void) ulwp_unlock(self, udp); in _thrp_exit()
887 self->ul_schedctl = NULL; in _thrp_exit()
888 self->ul_schedctl_called = &udp->uberflags; in _thrp_exit()
891 ASSERT(self->ul_critical == 1); in _thrp_exit()
892 ASSERT(self->ul_preempt == 0); in _thrp_exit()
919 ulwp_t *self = curthread; in _thrp_exit_common() local
920 int cancelled = (self->ul_cancel_pending && status == PTHREAD_CANCELED); in _thrp_exit_common()
922 ASSERT(self->ul_critical == 0 && self->ul_preempt == 0); in _thrp_exit_common()
930 self->ul_cancel_disabled = 1; in _thrp_exit_common()
931 self->ul_cancel_async = 0; in _thrp_exit_common()
932 self->ul_save_async = 0; in _thrp_exit_common()
933 self->ul_cancelable = 0; in _thrp_exit_common()
934 self->ul_cancel_pending = 0; in _thrp_exit_common()
935 set_cancel_pending_flag(self, 1); in _thrp_exit_common()
949 sigoff(self); in _thrp_exit_common()
951 self->ul_rval = status; in _thrp_exit_common()
960 self->ul_unwind = 1; in _thrp_exit_common()
1252 ulwp_t *self; in libc_init() local
1317 self = (ulwp_t *)(data + tls_size); in libc_init()
1318 init_hash_table[0].hash_bucket = self; in libc_init()
1320 self->ul_sigmask = uc.uc_sigmask; in libc_init()
1321 delete_reserved_signals(&self->ul_sigmask); in libc_init()
1328 ((self->ul_sigmask.__sigbits[0] ^ uc.uc_sigmask.__sigbits[0]) | in libc_init()
1329 (self->ul_sigmask.__sigbits[1] ^ uc.uc_sigmask.__sigbits[1]) | in libc_init()
1330 (self->ul_sigmask.__sigbits[2] ^ uc.uc_sigmask.__sigbits[2]) | in libc_init()
1331 (self->ul_sigmask.__sigbits[3] ^ uc.uc_sigmask.__sigbits[3])); in libc_init()
1340 self->ul_dsave = 0x9de04000; /* save %g1, %g0, %sp */ in libc_init()
1341 self->ul_drestore = 0x81e80000; /* restore %g0, %g0, %g0 */ in libc_init()
1342 self->ul_dftret = 0x91d0203a; /* ta 0x3a */ in libc_init()
1343 self->ul_dreturn = 0x81ca0000; /* return %o0 */ in libc_init()
1346 self->ul_stktop = (uintptr_t)uc.uc_stack.ss_sp + uc.uc_stack.ss_size; in libc_init()
1348 self->ul_stksiz = rl.rlim_cur; in libc_init()
1349 self->ul_stk = (caddr_t)(self->ul_stktop - self->ul_stksiz); in libc_init()
1351 self->ul_forw = self->ul_back = self; in libc_init()
1352 self->ul_hash = NULL; in libc_init()
1353 self->ul_ix = 0; in libc_init()
1354 self->ul_lwpid = 1; /* _lwp_self() */ in libc_init()
1355 self->ul_main = 1; in libc_init()
1356 self->ul_self = self; in libc_init()
1357 self->ul_policy = -1; /* initialize only when needed */ in libc_init()
1358 self->ul_pri = 0; in libc_init()
1359 self->ul_cid = 0; in libc_init()
1360 self->ul_rtclassid = -1; in libc_init()
1361 self->ul_uberdata = udp; in libc_init()
1367 self->ul_stsd = oldself->ul_stsd; in libc_init()
1369 self->ul_ftsd[i] = oldself->ul_ftsd[i]; in libc_init()
1370 self->ul_tls = oldself->ul_tls; in libc_init()
1393 udp->all_lwps = self; in libc_init()
1394 udp->ulwp_one = self; in libc_init()
1408 self->ul_primarymap = 1; in libc_init()
1420 self->ul_nocancel = 1; in libc_init()
1423 (void) ___lwp_private(_LWP_SETPRIVATE, _LWP_FSBASE, self); in libc_init()
1425 (void) ___lwp_private(_LWP_SETPRIVATE, _LWP_GSBASE, self); in libc_init()
1427 set_curthread(self); /* redundant on i386 */ in libc_init()
1432 self->ul_errnop = &errno; in libc_init()
1447 if (self->ul_stksiz == RLIM_INFINITY) { in libc_init()
1448 self->ul_ustack.ss_sp = (void *)self->ul_stktop; in libc_init()
1449 self->ul_ustack.ss_size = 0; in libc_init()
1451 self->ul_ustack.ss_sp = self->ul_stk; in libc_init()
1452 self->ul_ustack.ss_size = self->ul_stksiz; in libc_init()
1454 self->ul_ustack.ss_flags = 0; in libc_init()
1455 (void) setustack(&self->ul_ustack); in libc_init()
1467 self->ul_queue_fifo = (char)thread_queue_fifo; in libc_init()
1468 self->ul_cond_wait_defer = (char)thread_cond_wait_defer; in libc_init()
1469 self->ul_error_detection = (char)thread_error_detection; in libc_init()
1470 self->ul_async_safe = (char)thread_async_safe; in libc_init()
1471 self->ul_door_noreserve = (char)thread_door_noreserve; in libc_init()
1472 self->ul_misaligned = (char)thread_locks_misaligned; in libc_init()
1473 self->ul_max_spinners = (uint8_t)thread_max_spinners; in libc_init()
1474 self->ul_adaptive_spin = thread_adaptive_spin; in libc_init()
1475 self->ul_queue_spin = thread_queue_spin; in libc_init()
1478 if (self->ul_misaligned) { in libc_init()
1502 if (self->ul_primarymap) in libc_init()
1509 sigoff(self); in libc_init()
1511 sigon(self); in libc_init()
1513 (void) restore_signals(self); in libc_init()
1561 ulwp_t *self = curthread; in finish_init() local
1562 uberdata_t *udp = self->ul_uberdata; in finish_init()
1571 ASSERT(self->ul_primarymap); in finish_init()
1572 ASSERT(self == udp->ulwp_one); in finish_init()
1579 update_sched(self); in finish_init()
1604 hash_in_unlocked(self, TIDHASH(self->ul_lwpid, udp), udp); in finish_init()
1647 ulwp_t *self = curthread; in postfork1_child() local
1648 uberdata_t *udp = self->ul_uberdata; in postfork1_child()
1655 self->ul_usropts &= ~THR_DAEMON; in postfork1_child()
1662 self->ul_lwpid = _lwp_self(); in postfork1_child()
1663 hash_in_unlocked(self, TIDHASH(self->ul_lwpid, udp), udp); in postfork1_child()
1716 for (ulwp = self->ul_forw; ulwp != self; ulwp = next) { in postfork1_child()
1726 self->ul_forw = self->ul_back = udp->all_lwps = self; in postfork1_child()
1727 if (self != udp->ulwp_one) in postfork1_child()
1771 ulwp_t *self = __curthread(); in thr_main() local
1773 return ((self == NULL)? -1 : self->ul_main); in thr_main()
1802 ulwp_t *self = curthread; in force_continue() local
1803 uberdata_t *udp = self->ul_uberdata; in force_continue()
1808 ASSERT(MUTEX_OWNED(&udp->fork_lock, self)); in force_continue()
1809 ASSERT(MUTEX_OWNED(ulwp_mutex(ulwp, udp), self)); in force_continue()
1842 ulwp_t *self = curthread; in safe_suspend() local
1843 uberdata_t *udp = self->ul_uberdata; in safe_suspend()
1853 ASSERT(ulwp != self); in safe_suspend()
1855 ASSERT(MUTEX_OWNED(&udp->fork_lock, self)); in safe_suspend()
1856 ASSERT(MUTEX_OWNED(mp, self)); in safe_suspend()
1943 ulwp_t *self = curthread; in _thrp_suspend() local
1944 uberdata_t *udp = self->ul_uberdata; in _thrp_suspend()
1956 if (tid != self->ul_lwpid) in _thrp_suspend()
1968 } else if (ulwp != self) { in _thrp_suspend()
1984 enter_critical(self); in _thrp_suspend()
1985 self->ul_sp = stkptr(); in _thrp_suspend()
1987 self->ul_pleasestop = 0; in _thrp_suspend()
1988 self->ul_stop |= whystopped; in _thrp_suspend()
1995 spin_lock_set(&self->ul_spinlock); in _thrp_suspend()
1996 self->ul_stopping = 1; in _thrp_suspend()
1997 ulwp_broadcast(self); in _thrp_suspend()
1998 ulwp_unlock(self, udp); in _thrp_suspend()
2023 self->ul_schedctl = NULL; in _thrp_suspend()
2024 self->ul_schedctl_called = &udp->uberflags; in _thrp_suspend()
2026 spin_lock_clear(&self->ul_spinlock); in _thrp_suspend()
2034 self->ul_stopping = 0; in _thrp_suspend()
2035 self->ul_sp = 0; in _thrp_suspend()
2037 self->ul_schedctl_called = NULL; in _thrp_suspend()
2038 self->ul_schedctl = NULL; in _thrp_suspend()
2041 ulwp_lock(self, udp); in _thrp_suspend()
2042 ulwp_broadcast(self); in _thrp_suspend()
2043 ulwp_unlock(self, udp); in _thrp_suspend()
2044 exit_critical(self); in _thrp_suspend()
2047 if (tid != self->ul_lwpid) in _thrp_suspend()
2059 ulwp_t *self = curthread; in suspend_fork() local
2060 uberdata_t *udp = self->ul_uberdata; in suspend_fork()
2064 ASSERT(MUTEX_OWNED(&udp->fork_lock, self)); in suspend_fork()
2068 for (ulwp = self->ul_forw; ulwp != self; ulwp = ulwp->ul_forw) { in suspend_fork()
2090 ulwp_t *self = curthread; in continue_fork() local
2091 uberdata_t *udp = self->ul_uberdata; in continue_fork()
2094 ASSERT(MUTEX_OWNED(&udp->fork_lock, self)); in continue_fork()
2100 for (ulwp = self->ul_forw; ulwp != self; ulwp = ulwp->ul_forw) { in continue_fork()
2111 for (ulwp = self->ul_forw; ulwp != self; ulwp = ulwp->ul_forw) { in continue_fork()
2200 ulwp_t *self = curthread; in do_exit_critical() local
2203 ASSERT(self->ul_critical == 0); in do_exit_critical()
2209 if (self->ul_dead || self->ul_rtld) in do_exit_critical()
2212 while (self->ul_pleasestop || in do_exit_critical()
2213 (self->ul_cursig != 0 && self->ul_sigdefer == 0)) { in do_exit_critical()
2218 self->ul_critical++; in do_exit_critical()
2219 while (self->ul_pleasestop) { in do_exit_critical()
2225 set_parking_flag(self, 0); in do_exit_critical()
2226 (void) _thrp_suspend(self->ul_lwpid, in do_exit_critical()
2227 self->ul_pleasestop); in do_exit_critical()
2229 self->ul_critical--; in do_exit_critical()
2231 if ((sig = self->ul_cursig) != 0 && self->ul_sigdefer == 0) { in do_exit_critical()
2239 self->ul_cursig = 0; in do_exit_critical()
2241 ASSERT(self->ul_cursig == 0); in do_exit_critical()
2244 ASSERT(self->ul_critical == 0); in do_exit_critical()
2259 ulwp_t *self = curthread; in _ti_bind_guard() local
2260 uberdata_t *udp = self->ul_uberdata; in _ti_bind_guard()
2263 if ((self->ul_bindflags & bindflag) == bindflag) in _ti_bind_guard()
2265 self->ul_bindflags |= bindflag; in _ti_bind_guard()
2267 sigoff(self); /* see no signals while holding ld_lock */ in _ti_bind_guard()
2268 self->ul_rtld++; /* don't suspend while in ld.so.1 */ in _ti_bind_guard()
2271 enter_critical(self); in _ti_bind_guard()
2272 self->ul_save_state = self->ul_cancel_disabled; in _ti_bind_guard()
2273 self->ul_cancel_disabled = 1; in _ti_bind_guard()
2274 set_cancel_pending_flag(self, 0); in _ti_bind_guard()
2281 ulwp_t *self = curthread; in _ti_bind_clear() local
2282 uberdata_t *udp = self->ul_uberdata; in _ti_bind_clear()
2285 if ((self->ul_bindflags & bindflag) == 0) in _ti_bind_clear()
2286 return (self->ul_bindflags); in _ti_bind_clear()
2287 self->ul_bindflags &= ~bindflag; in _ti_bind_clear()
2288 self->ul_cancel_disabled = self->ul_save_state; in _ti_bind_clear()
2289 set_cancel_pending_flag(self, 0); in _ti_bind_clear()
2290 exit_critical(self); in _ti_bind_clear()
2292 if (MUTEX_OWNED(&udp->ld_lock, self)) { in _ti_bind_clear()
2294 self->ul_rtld--; in _ti_bind_clear()
2295 sigon(self); /* reenable signals */ in _ti_bind_clear()
2298 return (self->ul_bindflags); in _ti_bind_clear()
2308 ulwp_t *self = curthread; in _ti_critical() local
2309 int level = self->ul_critical; in _ti_critical()
2311 if ((self->ul_bindflags & THR_FLG_RTLD) == 0 || level == 0) in _ti_critical()
2331 ulwp_t *self = curthread; in _sigoff() local
2333 sigoff(self); in _sigoff()
2339 ulwp_t *self = curthread; in _sigon() local
2341 ASSERT(self->ul_sigdefer > 0); in _sigon()
2342 sigon(self); in _sigon()
2498 ulwp_t *self = curthread; in thr_getstate() local
2499 uberdata_t *udp = self->ul_uberdata; in thr_getstate()
2505 if (tid == 0 || self->ul_lwpid == tid) { in thr_getstate()
2506 ulwp = self; in thr_getstate()
2688 ulwp_t *self = curthread; in thr_setmutator() local
2689 uberdata_t *udp = self->ul_uberdata; in thr_setmutator()
2697 ulwp = self; in thr_setmutator()
2708 if (ulwp != self && !ulwp->ul_stop && enabled) in thr_setmutator()
2771 ulwp_t *self = curthread; in thr_suspend_allmutators() local
2772 uberdata_t *udp = self->ul_uberdata; in thr_suspend_allmutators()
2791 for (ulwp = self->ul_forw; ulwp != self; ulwp = ulwp->ul_forw) { in thr_suspend_allmutators()
2842 ulwp_t *self = curthread; in thr_continue_allmutators() local
2843 uberdata_t *udp = self->ul_uberdata; in thr_continue_allmutators()
2859 for (ulwp = self->ul_forw; ulwp != self; ulwp = ulwp->ul_forw) { in thr_continue_allmutators()