thr_private.h (117706) | thr_private.h (117715) |
---|---|
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 117706 2003-07-17 23:02:30Z davidxu $ | 34 * $FreeBSD: head/lib/libkse/thread/thr_private.h 117715 2003-07-18 02:46:55Z deischen $ |
35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Include files. 42 */ --- 840 unchanged lines hidden (view full) --- 883 * does not (currently) have a statically assigned kse. 884 */ 885#define THR_RUNQ_INSERT_HEAD(thrd) \ 886 _pq_insert_head(&(thrd)->kseg->kg_schedq.sq_runq, thrd) 887#define THR_RUNQ_INSERT_TAIL(thrd) \ 888 _pq_insert_tail(&(thrd)->kseg->kg_schedq.sq_runq, thrd) 889#define THR_RUNQ_REMOVE(thrd) \ 890 _pq_remove(&(thrd)->kseg->kg_schedq.sq_runq, thrd) | 35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Include files. 42 */ --- 840 unchanged lines hidden (view full) --- 883 * does not (currently) have a statically assigned kse. 884 */ 885#define THR_RUNQ_INSERT_HEAD(thrd) \ 886 _pq_insert_head(&(thrd)->kseg->kg_schedq.sq_runq, thrd) 887#define THR_RUNQ_INSERT_TAIL(thrd) \ 888 _pq_insert_tail(&(thrd)->kseg->kg_schedq.sq_runq, thrd) 889#define THR_RUNQ_REMOVE(thrd) \ 890 _pq_remove(&(thrd)->kseg->kg_schedq.sq_runq, thrd) |
891#define THR_RUNQ_FIRST() \ | 891#define THR_RUNQ_FIRST(thrd) \ |
892 _pq_first(&(thrd)->kseg->kg_schedq.sq_runq) 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) { \ --- 42 unchanged lines hidden (view full) --- 942 _kse_critical_leave((curthr)->critical[(curthr)->locklevel]); \ 943} while (0) 944 945/* Take the scheduling lock with the intent to call the scheduler. */ 946#define THR_LOCK_SWITCH(curthr) do { \ 947 (void)_kse_critical_enter(); \ 948 KSE_SCHED_LOCK((curthr)->kse, (curthr)->kseg); \ 949} while (0) | 892 _pq_first(&(thrd)->kseg->kg_schedq.sq_runq) 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) { \ --- 42 unchanged lines hidden (view full) --- 942 _kse_critical_leave((curthr)->critical[(curthr)->locklevel]); \ 943} while (0) 944 945/* Take the scheduling lock with the intent to call the scheduler. */ 946#define THR_LOCK_SWITCH(curthr) do { \ 947 (void)_kse_critical_enter(); \ 948 KSE_SCHED_LOCK((curthr)->kse, (curthr)->kseg); \ 949} while (0) |
950#define THR_UNLOCK_SWITCH(curthr) do { \ 951 KSE_SCHED_UNLOCK((curthr)->kse, (curthr)->kseg);\ 952} while (0) |
|
950 951#define THR_CRITICAL_ENTER(thr) (thr)->critical_count++ 952#define THR_CRITICAL_LEAVE(thr) do { \ 953 (thr)->critical_count--; \ 954 if (((thr)->critical_yield != 0) && \ 955 ((thr)->critical_count == 0)) { \ 956 (thr)->critical_yield = 0; \ 957 _thr_sched_switch(thr); \ --- 26 unchanged lines hidden (view full) --- 984SCLASS TAILQ_HEAD(, pthread) _thread_gc_list 985 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); 986 987/* Default thread attributes: */ 988SCLASS struct pthread_attr _pthread_attr_default 989 SCLASS_PRESET({ 990 SCHED_RR, 0, TIMESLICE_USEC, THR_DEFAULT_PRIORITY, 991 THR_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, | 953 954#define THR_CRITICAL_ENTER(thr) (thr)->critical_count++ 955#define THR_CRITICAL_LEAVE(thr) do { \ 956 (thr)->critical_count--; \ 957 if (((thr)->critical_yield != 0) && \ 958 ((thr)->critical_count == 0)) { \ 959 (thr)->critical_yield = 0; \ 960 _thr_sched_switch(thr); \ --- 26 unchanged lines hidden (view full) --- 987SCLASS TAILQ_HEAD(, pthread) _thread_gc_list 988 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); 989 990/* Default thread attributes: */ 991SCLASS struct pthread_attr _pthread_attr_default 992 SCLASS_PRESET({ 993 SCHED_RR, 0, TIMESLICE_USEC, THR_DEFAULT_PRIORITY, 994 THR_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, |
992 NULL, NULL, THR_STACK_DEFAULT | 995 NULL, NULL, THR_STACK_DEFAULT, /* guardsize */0 |
993 }); 994 995/* Default mutex attributes: */ 996SCLASS struct pthread_mutex_attr _pthread_mutexattr_default 997 SCLASS_PRESET({PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }); 998 999/* Default condition variable attributes: */ 1000SCLASS struct pthread_cond_attr _pthread_condattr_default --- 240 unchanged lines hidden --- | 996 }); 997 998/* Default mutex attributes: */ 999SCLASS struct pthread_mutex_attr _pthread_mutexattr_default 1000 SCLASS_PRESET({PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }); 1001 1002/* Default condition variable attributes: */ 1003SCLASS struct pthread_cond_attr _pthread_condattr_default --- 240 unchanged lines hidden --- |