summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_private.h
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-04-11 07:47:22 +0000
committerjb <jb@FreeBSD.org>1998-04-11 07:47:22 +0000
commit19185ac5121f9f5c12adb893404acf3e8c9db6d4 (patch)
treed3cd2f1400e0868d686f6f4a6969a4e33d538f1c /lib/libpthread/thread/thr_private.h
parent0ff63017b40dda207b2aadc9881e0c93e7fd2753 (diff)
downloadFreeBSD-src-19185ac5121f9f5c12adb893404acf3e8c9db6d4.zip
FreeBSD-src-19185ac5121f9f5c12adb893404acf3e8c9db6d4.tar.gz
Change the FILE locking to be by FILE, not by the underlying fd as
it was. Add a FILE_WAIT state and queue threads waiting for a FILE lock. Start using the sys/queue.h macros instead of the way that MIT pthreads did it. Add a thread name to the private thread structure and a non-POSIX function to set this. This helps (me at least) when sending a SIGINFO to a threaded process to get a /tmp/uthread.dump to see what the <expletive deleted> threads are doing this time. It is nice to be able to recognise (yes, I spell that with an 's' too) which threads are which.
Diffstat (limited to 'lib/libpthread/thread/thr_private.h')
-rw-r--r--lib/libpthread/thread/thr_private.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index dc36d8d..5ceeaba 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/thread/thr_private.h
@@ -50,6 +50,7 @@
*/
#include <setjmp.h>
#include <signal.h>
+#include <sys/queue.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sched.h>
@@ -219,6 +220,7 @@ enum pthread_state {
PS_FDLW_WAIT,
PS_FDR_WAIT,
PS_FDW_WAIT,
+ PS_FILE_WAIT,
PS_SELECT_WAIT,
PS_SLEEP_WAIT,
PS_WAIT_WAIT,
@@ -283,6 +285,7 @@ struct pthread {
*/
#define PTHREAD_MAGIC ((u_int32_t) 0xd09ba115)
u_int32_t magic;
+ char *name;
/*
* Pointer to the next thread in the thread linked list.
@@ -387,12 +390,18 @@ struct pthread {
* The current thread can belong to only one queue at a time.
*
* Pointer to queue (if any) on which the current thread is waiting.
+ *
+ * XXX The queuing should be changed to use the TAILQ entry below.
+ * XXX For the time being, it's hybrid.
*/
struct pthread_queue *queue;
/* Pointer to next element in queue. */
struct pthread *qnxt;
+ /* Queue entry for this thread: */
+ TAILQ_ENTRY(pthread) qe;
+
/* Wait data. */
union pthread_wait_data data;
@@ -634,8 +643,6 @@ ssize_t _thread_sys_sendto(int, const void *,size_t, int, const struct sockaddr
/* #include <stdio.h> */
#ifdef _STDIO_H_
-void _thread_flockfile(FILE *fp,char *fname,int lineno);
-void _thread_funlockfile(FILE *fp);
FILE *_thread_sys_fdopen(int, const char *);
FILE *_thread_sys_fopen(const char *, const char *);
FILE *_thread_sys_freopen(const char *, const char *, FILE *);
OpenPOWER on IntegriCloud