summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-09-30 06:22:07 +0000
committerjb <jb@FreeBSD.org>1998-09-30 06:22:07 +0000
commit91d2ee98318cba6ca2d8e92500ff4c06de7626ce (patch)
tree9921b3468ae930fefd9473dea69356c1cb8cd2ad /lib
parent8d80497304344bdb9a8026712fe7a445eaf95b79 (diff)
downloadFreeBSD-src-91d2ee98318cba6ca2d8e92500ff4c06de7626ce.zip
FreeBSD-src-91d2ee98318cba6ca2d8e92500ff4c06de7626ce.tar.gz
- Fix the debug macros.
- Add support of a thread being listed in the dead thread list as well as the thread list. - Add a new thread state to make sigwait work properly. (Submitted by Daniel M. Eischen <eischen@vigrid.com>) - Add global variable for the garbage collector mutex and condition variable. - Delete a couple of prototypes that are no longer required. - Add a prototype for the garbage collector thread.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/pthread_private.h25
-rw-r--r--lib/libkse/thread/thr_private.h25
-rw-r--r--lib/libpthread/thread/thr_private.h25
3 files changed, 63 insertions, 12 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index 5b76a86..04600cf 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -62,8 +62,8 @@
#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
/* Output debug messages like this: */
-#define stdout_debug(_x) _write(1,_x,strlen(_x));
-#define stderr_debug(_x) _write(2,_x,strlen(_x));
+#define stdout_debug(_x) _thread_sys_write(1,_x,strlen(_x));
+#define stderr_debug(_x) _thread_sys_write(2,_x,strlen(_x));
/*
* State change macro:
@@ -252,6 +252,7 @@ enum pthread_state {
PS_SELECT_WAIT,
PS_SLEEP_WAIT,
PS_WAIT_WAIT,
+ PS_SIGSUSPEND,
PS_SIGWAIT,
PS_JOIN,
PS_SUSPENDED,
@@ -333,6 +334,11 @@ struct pthread {
struct pthread *nxt;
/*
+ * Pointer to the next thread in the dead thread linked list.
+ */
+ struct pthread *nxt_dead;
+
+ /*
* Thread start routine, argument, stack pointer and thread
* attributes.
*/
@@ -591,6 +597,18 @@ SCLASS int _thread_dtablesize /* Descriptor table size. */
;
#endif
+/* Garbage collector mutex and condition variable. */
+SCLASS pthread_mutex_t _gc_mutex
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+SCLASS pthread_cond_t _gc_cond
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+
/*
* Array of signal actions for this process.
*/
@@ -623,10 +641,8 @@ int _thread_fd_lock(int, int, struct timespec *);
int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno);
void _dispatch_signals(void);
void _thread_signal(pthread_t, int);
-void _lock_dead_thread_list(void);
void _lock_thread(void);
void _lock_thread_list(void);
-void _unlock_dead_thread_list(void);
void _unlock_thread(void);
void _unlock_thread_list(void);
void _thread_exit(char *, int, char *);
@@ -649,6 +665,7 @@ int _thread_queue_remove(struct pthread_queue *, struct pthread *);
int _thread_fd_table_init(int fd);
struct pthread *_thread_queue_get(struct pthread_queue *);
struct pthread *_thread_queue_deq(struct pthread_queue *);
+pthread_addr_t _thread_gc(pthread_addr_t);
/* #include <signal.h> */
int _thread_sys_sigaction(int, const struct sigaction *, struct sigaction *);
diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h
index 5b76a86..04600cf 100644
--- a/lib/libkse/thread/thr_private.h
+++ b/lib/libkse/thread/thr_private.h
@@ -62,8 +62,8 @@
#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
/* Output debug messages like this: */
-#define stdout_debug(_x) _write(1,_x,strlen(_x));
-#define stderr_debug(_x) _write(2,_x,strlen(_x));
+#define stdout_debug(_x) _thread_sys_write(1,_x,strlen(_x));
+#define stderr_debug(_x) _thread_sys_write(2,_x,strlen(_x));
/*
* State change macro:
@@ -252,6 +252,7 @@ enum pthread_state {
PS_SELECT_WAIT,
PS_SLEEP_WAIT,
PS_WAIT_WAIT,
+ PS_SIGSUSPEND,
PS_SIGWAIT,
PS_JOIN,
PS_SUSPENDED,
@@ -333,6 +334,11 @@ struct pthread {
struct pthread *nxt;
/*
+ * Pointer to the next thread in the dead thread linked list.
+ */
+ struct pthread *nxt_dead;
+
+ /*
* Thread start routine, argument, stack pointer and thread
* attributes.
*/
@@ -591,6 +597,18 @@ SCLASS int _thread_dtablesize /* Descriptor table size. */
;
#endif
+/* Garbage collector mutex and condition variable. */
+SCLASS pthread_mutex_t _gc_mutex
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+SCLASS pthread_cond_t _gc_cond
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+
/*
* Array of signal actions for this process.
*/
@@ -623,10 +641,8 @@ int _thread_fd_lock(int, int, struct timespec *);
int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno);
void _dispatch_signals(void);
void _thread_signal(pthread_t, int);
-void _lock_dead_thread_list(void);
void _lock_thread(void);
void _lock_thread_list(void);
-void _unlock_dead_thread_list(void);
void _unlock_thread(void);
void _unlock_thread_list(void);
void _thread_exit(char *, int, char *);
@@ -649,6 +665,7 @@ int _thread_queue_remove(struct pthread_queue *, struct pthread *);
int _thread_fd_table_init(int fd);
struct pthread *_thread_queue_get(struct pthread_queue *);
struct pthread *_thread_queue_deq(struct pthread_queue *);
+pthread_addr_t _thread_gc(pthread_addr_t);
/* #include <signal.h> */
int _thread_sys_sigaction(int, const struct sigaction *, struct sigaction *);
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index 5b76a86..04600cf 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/thread/thr_private.h
@@ -62,8 +62,8 @@
#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
/* Output debug messages like this: */
-#define stdout_debug(_x) _write(1,_x,strlen(_x));
-#define stderr_debug(_x) _write(2,_x,strlen(_x));
+#define stdout_debug(_x) _thread_sys_write(1,_x,strlen(_x));
+#define stderr_debug(_x) _thread_sys_write(2,_x,strlen(_x));
/*
* State change macro:
@@ -252,6 +252,7 @@ enum pthread_state {
PS_SELECT_WAIT,
PS_SLEEP_WAIT,
PS_WAIT_WAIT,
+ PS_SIGSUSPEND,
PS_SIGWAIT,
PS_JOIN,
PS_SUSPENDED,
@@ -333,6 +334,11 @@ struct pthread {
struct pthread *nxt;
/*
+ * Pointer to the next thread in the dead thread linked list.
+ */
+ struct pthread *nxt_dead;
+
+ /*
* Thread start routine, argument, stack pointer and thread
* attributes.
*/
@@ -591,6 +597,18 @@ SCLASS int _thread_dtablesize /* Descriptor table size. */
;
#endif
+/* Garbage collector mutex and condition variable. */
+SCLASS pthread_mutex_t _gc_mutex
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+SCLASS pthread_cond_t _gc_cond
+#ifdef GLOBAL_PTHREAD_PRIVATE
+= NULL
+#endif
+;
+
/*
* Array of signal actions for this process.
*/
@@ -623,10 +641,8 @@ int _thread_fd_lock(int, int, struct timespec *);
int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno);
void _dispatch_signals(void);
void _thread_signal(pthread_t, int);
-void _lock_dead_thread_list(void);
void _lock_thread(void);
void _lock_thread_list(void);
-void _unlock_dead_thread_list(void);
void _unlock_thread(void);
void _unlock_thread_list(void);
void _thread_exit(char *, int, char *);
@@ -649,6 +665,7 @@ int _thread_queue_remove(struct pthread_queue *, struct pthread *);
int _thread_fd_table_init(int fd);
struct pthread *_thread_queue_get(struct pthread_queue *);
struct pthread *_thread_queue_deq(struct pthread_queue *);
+pthread_addr_t _thread_gc(pthread_addr_t);
/* #include <signal.h> */
int _thread_sys_sigaction(int, const struct sigaction *, struct sigaction *);
OpenPOWER on IntegriCloud