633 thread_lock(t); /* get dispatcher lock on thread */
634 t->t_clfuncs = &(sclass[cid].cl_funcs->thread);
635 t->t_cid = cid;
636 t->t_cldata = (void *)tspp;
637 t->t_schedflag &= ~TS_RUNQMATCH;
638 ts_change_priority(t, tspp);
639 thread_unlock(t);
640
641 /*
642 * Link new structure into tsproc list.
643 */
644 TS_LIST_INSERT(tspp);
645
646 /*
647 * If this is the first time-sharing thread to occur since
648 * boot we set up the initial call to ts_update() here.
649 * Use an atomic compare-and-swap since that's easier and
650 * faster than a mutex (but check with an ordinary load first
651 * since most of the time this will already be done).
652 */
653 if (tspexists == 0 && cas32(&tspexists, 0, 1) == 0)
654 (void) timeout(ts_update, NULL, hz);
655
656 return (0);
657 }
658
659
660 /*
661 * Free tsproc structure of thread.
662 */
663 static void
664 ts_exitclass(void *procp)
665 {
666 tsproc_t *tspp = (tsproc_t *)procp;
667
668 /* Remove tsproc_t structure from list */
669 TS_LIST_DELETE(tspp);
670 kmem_free(tspp, sizeof (tsproc_t));
671 }
672
673 /* ARGSUSED */
|
633 thread_lock(t); /* get dispatcher lock on thread */
634 t->t_clfuncs = &(sclass[cid].cl_funcs->thread);
635 t->t_cid = cid;
636 t->t_cldata = (void *)tspp;
637 t->t_schedflag &= ~TS_RUNQMATCH;
638 ts_change_priority(t, tspp);
639 thread_unlock(t);
640
641 /*
642 * Link new structure into tsproc list.
643 */
644 TS_LIST_INSERT(tspp);
645
646 /*
647 * If this is the first time-sharing thread to occur since
648 * boot we set up the initial call to ts_update() here.
649 * Use an atomic compare-and-swap since that's easier and
650 * faster than a mutex (but check with an ordinary load first
651 * since most of the time this will already be done).
652 */
653 if (tspexists == 0 && atomic_cas_32(&tspexists, 0, 1) == 0)
654 (void) timeout(ts_update, NULL, hz);
655
656 return (0);
657 }
658
659
660 /*
661 * Free tsproc structure of thread.
662 */
663 static void
664 ts_exitclass(void *procp)
665 {
666 tsproc_t *tspp = (tsproc_t *)procp;
667
668 /* Remove tsproc_t structure from list */
669 TS_LIST_DELETE(tspp);
670 kmem_free(tspp, sizeof (tsproc_t));
671 }
672
673 /* ARGSUSED */
|