thr_private.h (116977) | thr_private.h (117706) |
---|---|
1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * Private thread definitions for the uthread kernel. 33 * | 1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * Private thread definitions for the uthread kernel. 33 * |
34 * $FreeBSD: head/lib/libkse/thread/thr_private.h 116977 2003-06-28 09:55:02Z davidxu $ | 34 * $FreeBSD: head/lib/libkse/thread/thr_private.h 117706 2003-07-17 23:02:30Z davidxu $ |
35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Include files. 42 */ --- 154 unchanged lines hidden (view full) --- 197#define KF_STARTED 0x0001 /* kernel kse created */ 198#define KF_INITIALIZED 0x0002 /* initialized on 1st upcall */ 199 int k_waiting; 200 int k_idle; /* kse is idle */ 201 int k_error; /* syscall errno in critical */ 202 int k_cpu; /* CPU ID when bound */ 203 int k_done; /* this KSE is done */ 204 int k_switch; /* thread switch in UTS */ | 35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Include files. 42 */ --- 154 unchanged lines hidden (view full) --- 197#define KF_STARTED 0x0001 /* kernel kse created */ 198#define KF_INITIALIZED 0x0002 /* initialized on 1st upcall */ 199 int k_waiting; 200 int k_idle; /* kse is idle */ 201 int k_error; /* syscall errno in critical */ 202 int k_cpu; /* CPU ID when bound */ 203 int k_done; /* this KSE is done */ 204 int k_switch; /* thread switch in UTS */ |
205 int k_sigseqno; /* signal buffered count */ |
|
205}; 206 207/* 208 * Each KSE group contains one or more KSEs in which threads can run. 209 * At least for now, there is one scheduling queue per KSE group; KSEs 210 * within the same KSE group compete for threads from the same scheduling 211 * queue. A scope system thread has one KSE in one KSE group; the group 212 * does not use its scheduling queue. --- 397 unchanged lines hidden (view full) --- 610 611 /* Queue entry for list of all threads: */ 612 TAILQ_ENTRY(pthread) tle; /* link for all threads in process */ 613 TAILQ_ENTRY(pthread) kle; /* link for all threads in KSE/KSEG */ 614 615 /* Queue entry for GC lists: */ 616 TAILQ_ENTRY(pthread) gcle; 617 | 206}; 207 208/* 209 * Each KSE group contains one or more KSEs in which threads can run. 210 * At least for now, there is one scheduling queue per KSE group; KSEs 211 * within the same KSE group compete for threads from the same scheduling 212 * queue. A scope system thread has one KSE in one KSE group; the group 213 * does not use its scheduling queue. --- 397 unchanged lines hidden (view full) --- 611 612 /* Queue entry for list of all threads: */ 613 TAILQ_ENTRY(pthread) tle; /* link for all threads in process */ 614 TAILQ_ENTRY(pthread) kle; /* link for all threads in KSE/KSEG */ 615 616 /* Queue entry for GC lists: */ 617 TAILQ_ENTRY(pthread) gcle; 618 |
619 /* Hash queue entry */ 620 LIST_ENTRY(pthread) hle; 621 |
|
618 /* 619 * Lock for accesses to this thread structure. 620 */ 621 struct lock lock; 622 struct lockuser lockusers[MAX_THR_LOCKLEVEL]; 623 int locklevel; 624 kse_critical_t critical[MAX_KSE_LOCKLEVEL]; 625 struct kse *kse; --- 31 unchanged lines hidden (view full) --- 657 658 /* 659 * The thread's base and pending signal masks. The active 660 * signal mask is stored in the thread's context (in mailbox). 661 */ 662 sigset_t oldsigmask; 663 sigset_t sigmask; 664 sigset_t sigpend; | 622 /* 623 * Lock for accesses to this thread structure. 624 */ 625 struct lock lock; 626 struct lockuser lockusers[MAX_THR_LOCKLEVEL]; 627 int locklevel; 628 kse_critical_t critical[MAX_KSE_LOCKLEVEL]; 629 struct kse *kse; --- 31 unchanged lines hidden (view full) --- 661 662 /* 663 * The thread's base and pending signal masks. The active 664 * signal mask is stored in the thread's context (in mailbox). 665 */ 666 sigset_t oldsigmask; 667 sigset_t sigmask; 668 sigset_t sigpend; |
665 int check_pending; | 669 volatile int check_pending; |
666 int refcount; 667 668 /* Thread state: */ 669 enum pthread_state state; 670 volatile int lock_switch; 671 672 /* 673 * Number of microseconds accumulated by this thread when --- 215 unchanged lines hidden (view full) --- 889 890/* 891 * Macros to insert/remove threads to the all thread list and 892 * the gc list. 893 */ 894#define THR_LIST_ADD(thrd) do { \ 895 if (((thrd)->flags & THR_FLAGS_IN_TDLIST) == 0) { \ 896 TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \ | 670 int refcount; 671 672 /* Thread state: */ 673 enum pthread_state state; 674 volatile int lock_switch; 675 676 /* 677 * Number of microseconds accumulated by this thread when --- 215 unchanged lines hidden (view full) --- 893 894/* 895 * Macros to insert/remove threads to the all thread list and 896 * the gc list. 897 */ 898#define THR_LIST_ADD(thrd) do { \ 899 if (((thrd)->flags & THR_FLAGS_IN_TDLIST) == 0) { \ 900 TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \ |
901 _thr_hash_add(thrd); \ |
|
897 (thrd)->flags |= THR_FLAGS_IN_TDLIST; \ 898 } \ 899} while (0) 900#define THR_LIST_REMOVE(thrd) do { \ 901 if (((thrd)->flags & THR_FLAGS_IN_TDLIST) != 0) { \ 902 TAILQ_REMOVE(&_thread_list, thrd, tle); \ | 902 (thrd)->flags |= THR_FLAGS_IN_TDLIST; \ 903 } \ 904} while (0) 905#define THR_LIST_REMOVE(thrd) do { \ 906 if (((thrd)->flags & THR_FLAGS_IN_TDLIST) != 0) { \ 907 TAILQ_REMOVE(&_thread_list, thrd, tle); \ |
908 _thr_hash_remove(thrd); \ |
|
903 (thrd)->flags &= ~THR_FLAGS_IN_TDLIST; \ 904 } \ 905} while (0) 906#define THR_GCLIST_ADD(thrd) do { \ 907 if (((thrd)->flags & THR_FLAGS_IN_GCLIST) == 0) { \ 908 TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\ 909 (thrd)->flags |= THR_FLAGS_IN_GCLIST; \ 910 _gc_count++; \ --- 85 unchanged lines hidden (view full) --- 996 997/* Clock resolution in usec. */ 998SCLASS int _clock_res_usec SCLASS_PRESET(CLOCK_RES_USEC); 999 1000/* Array of signal actions for this process: */ 1001SCLASS struct sigaction _thread_sigact[_SIG_MAXSIG]; 1002 1003/* | 909 (thrd)->flags &= ~THR_FLAGS_IN_TDLIST; \ 910 } \ 911} while (0) 912#define THR_GCLIST_ADD(thrd) do { \ 913 if (((thrd)->flags & THR_FLAGS_IN_GCLIST) == 0) { \ 914 TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\ 915 (thrd)->flags |= THR_FLAGS_IN_GCLIST; \ 916 _gc_count++; \ --- 85 unchanged lines hidden (view full) --- 1002 1003/* Clock resolution in usec. */ 1004SCLASS int _clock_res_usec SCLASS_PRESET(CLOCK_RES_USEC); 1005 1006/* Array of signal actions for this process: */ 1007SCLASS struct sigaction _thread_sigact[_SIG_MAXSIG]; 1008 1009/* |
1004 * Array of counts of dummy handlers for SIG_DFL signals. This is used to 1005 * assure that there is always a dummy signal handler installed while there 1006 * is a thread sigwait()ing on the corresponding signal. 1007 */ 1008SCLASS int _thread_dfl_count[_SIG_MAXSIG]; 1009 1010/* | |
1011 * Lock for above count of dummy handlers and for the process signal 1012 * mask and pending signal sets. 1013 */ 1014SCLASS struct lock _thread_signal_lock; 1015 1016/* Pending signals and mask for this process: */ 1017SCLASS sigset_t _thr_proc_sigpending; 1018SCLASS siginfo_t _thr_proc_siginfo[_SIG_MAXSIG]; --- 23 unchanged lines hidden (view full) --- 1042 * Function prototype definitions. 1043 */ 1044__BEGIN_DECLS 1045int _cond_reinit(pthread_cond_t *); 1046void _cond_wait_backout(struct pthread *); 1047struct pthread *_get_curthread(void); 1048struct kse *_get_curkse(void); 1049void _set_curkse(struct kse *); | 1010 * Lock for above count of dummy handlers and for the process signal 1011 * mask and pending signal sets. 1012 */ 1013SCLASS struct lock _thread_signal_lock; 1014 1015/* Pending signals and mask for this process: */ 1016SCLASS sigset_t _thr_proc_sigpending; 1017SCLASS siginfo_t _thr_proc_siginfo[_SIG_MAXSIG]; --- 23 unchanged lines hidden (view full) --- 1041 * Function prototype definitions. 1042 */ 1043__BEGIN_DECLS 1044int _cond_reinit(pthread_cond_t *); 1045void _cond_wait_backout(struct pthread *); 1046struct pthread *_get_curthread(void); 1047struct kse *_get_curkse(void); 1048void _set_curkse(struct kse *); |
1050struct kse *_kse_alloc(struct pthread *); | 1049struct kse *_kse_alloc(struct pthread *, int sys_scope); |
1051kse_critical_t _kse_critical_enter(void); 1052void _kse_critical_leave(kse_critical_t); 1053int _kse_in_critical(void); 1054void _kse_free(struct pthread *, struct kse *); 1055void _kse_init(); 1056struct kse_group *_kseg_alloc(struct pthread *); 1057void _kse_lock_wait(struct lock *, struct lockuser *lu); 1058void _kse_lock_wakeup(struct lock *, struct lockuser *lu); --- 67 unchanged lines hidden (view full) --- 1126 struct pthread_sigframe *); 1127void _thr_sig_send(struct pthread *pthread, int sig); 1128void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf); 1129void _thr_spinlock_init(void); 1130void _thr_enter_cancellation_point(struct pthread *); 1131void _thr_leave_cancellation_point(struct pthread *); 1132int _thr_setconcurrency(int new_level); 1133int _thr_setmaxconcurrency(void); | 1050kse_critical_t _kse_critical_enter(void); 1051void _kse_critical_leave(kse_critical_t); 1052int _kse_in_critical(void); 1053void _kse_free(struct pthread *, struct kse *); 1054void _kse_init(); 1055struct kse_group *_kseg_alloc(struct pthread *); 1056void _kse_lock_wait(struct lock *, struct lockuser *lu); 1057void _kse_lock_wakeup(struct lock *, struct lockuser *lu); --- 67 unchanged lines hidden (view full) --- 1125 struct pthread_sigframe *); 1126void _thr_sig_send(struct pthread *pthread, int sig); 1127void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf); 1128void _thr_spinlock_init(void); 1129void _thr_enter_cancellation_point(struct pthread *); 1130void _thr_leave_cancellation_point(struct pthread *); 1131int _thr_setconcurrency(int new_level); 1132int _thr_setmaxconcurrency(void); |
1133void _thr_critical_enter(struct pthread *); 1134void _thr_critical_leave(struct pthread *); |
|
1134int _thr_start_sig_daemon(void); 1135int _thr_getprocsig(int sig, siginfo_t *siginfo); 1136int _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo); 1137void _thr_signal_init(void); 1138void _thr_signal_deinit(void); | 1135int _thr_start_sig_daemon(void); 1136int _thr_getprocsig(int sig, siginfo_t *siginfo); 1137int _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo); 1138void _thr_signal_init(void); 1139void _thr_signal_deinit(void); |
1140void _thr_hash_add(struct pthread *); 1141void _thr_hash_remove(struct pthread *); 1142struct pthread *_thr_hash_find(struct pthread *); |
|
1139 1140/* 1141 * Aliases for _pthread functions. Should be called instead of 1142 * originals if PLT replocation is unwanted at runtme. 1143 */ 1144int _thr_cond_broadcast(pthread_cond_t *); 1145int _thr_cond_signal(pthread_cond_t *); 1146int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); --- 90 unchanged lines hidden --- | 1143 1144/* 1145 * Aliases for _pthread functions. Should be called instead of 1146 * originals if PLT replocation is unwanted at runtme. 1147 */ 1148int _thr_cond_broadcast(pthread_cond_t *); 1149int _thr_cond_signal(pthread_cond_t *); 1150int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *); --- 90 unchanged lines hidden --- |