Lines Matching refs:tsd

133  * forward declarations for internal thread specific data (tsd)
1493 struct tsd_thread *tsd;
1512 for (tsd = tsd_list; tsd; tsd = tsd->ts_next) {
1516 if (key > tsd->ts_nkeys)
1521 if (tsd->ts_value[k] && tsd_destructor[k])
1522 (*tsd_destructor[k])(tsd->ts_value[k]);
1526 tsd->ts_value[k] = NULL;
1557 * Like tsd_get(), except that the agent lwp can get the tsd of
1564 struct tsd_thread *tsd = t->t_tsd;
1569 if (key && tsd != NULL && key <= tsd->ts_nkeys)
1570 return (tsd->ts_value[key - 1]);
1575 * Like tsd_set(), except that the agent lwp can set the tsd of
1576 * another thread in the same process, or syslwp can set the tsd
1586 struct tsd_thread *tsd = t->t_tsd;
1593 if (tsd == NULL)
1594 tsd = t->t_tsd = kmem_zalloc(sizeof (*tsd), KM_SLEEP);
1595 if (key <= tsd->ts_nkeys) {
1596 tsd->ts_value[key - 1] = value;
1606 if (tsd->ts_nkeys == 0) {
1610 if ((tsd->ts_next = tsd_list) != NULL)
1611 tsd_list->ts_prev = tsd;
1612 tsd_list = tsd;
1618 tsd->ts_value = tsd_realloc(tsd->ts_value,
1619 tsd->ts_nkeys * sizeof (void *),
1621 tsd->ts_nkeys = key;
1622 tsd->ts_value[key - 1] = value;
1639 struct tsd_thread *tsd = curthread->t_tsd;
1641 if (tsd == NULL)
1642 tsd = curthread->t_tsd = kmem_zalloc(sizeof (*tsd), KM_SLEEP);
1643 if (key && key <= tsd->ts_nkeys && (value = tsd->ts_value[key - 1]))
1653 * Called from thread_exit() to run the destructor function for each tsd
1655 * Assumes that the destructor *DOES NOT* use tsd
1661 struct tsd_thread *tsd = curthread->t_tsd;
1663 if (tsd == NULL)
1666 if (tsd->ts_nkeys == 0) {
1667 kmem_free(tsd, sizeof (*tsd));
1678 for (i = 0; i < tsd->ts_nkeys; i++) {
1679 if (tsd->ts_value[i] && tsd_destructor[i])
1680 (*tsd_destructor[i])(tsd->ts_value[i]);
1681 tsd->ts_value[i] = NULL;
1687 if (tsd->ts_next)
1688 tsd->ts_next->ts_prev = tsd->ts_prev;
1689 if (tsd->ts_prev)
1690 tsd->ts_prev->ts_next = tsd->ts_next;
1691 if (tsd_list == tsd)
1692 tsd_list = tsd->ts_next;
1699 kmem_free(tsd->ts_value, tsd->ts_nkeys * sizeof (void *));
1700 kmem_free(tsd, sizeof (struct tsd_thread));