Deleted Added
full compact
thr_private.h (75187) thr_private.h (76909)
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 75187 2001-04-04 18:10:25Z tmm $
34 * $FreeBSD: head/lib/libkse/thread/thr_private.h 76909 2001-05-20 23:08:33Z jasone $
35 */
36
37#ifndef _PTHREAD_PRIVATE_H
38#define _PTHREAD_PRIVATE_H
39
40/*
41 * Evaluate the storage class specifier.
42 */

--- 355 unchanged lines hidden (view full) ---

398#define PTHREAD_CREATE_SUSPENDED 1
399
400/*
401 * Additional state for a thread suspended with pthread_suspend_np().
402 */
403enum pthread_susp {
404 SUSP_NO, /* Not suspended. */
405 SUSP_YES, /* Suspended. */
35 */
36
37#ifndef _PTHREAD_PRIVATE_H
38#define _PTHREAD_PRIVATE_H
39
40/*
41 * Evaluate the storage class specifier.
42 */

--- 355 unchanged lines hidden (view full) ---

398#define PTHREAD_CREATE_SUSPENDED 1
399
400/*
401 * Additional state for a thread suspended with pthread_suspend_np().
402 */
403enum pthread_susp {
404 SUSP_NO, /* Not suspended. */
405 SUSP_YES, /* Suspended. */
406 SUSP_JOIN, /* Suspended, joining. */
406 SUSP_NOWAIT, /* Suspended, was in a mutex or condition queue. */
407 SUSP_MUTEX_WAIT,/* Suspended, still in a mutex queue. */
408 SUSP_COND_WAIT /* Suspended, still in a condition queue. */
409};
410
411/*
412 * Miscellaneous definitions.
413 */

--- 154 unchanged lines hidden (view full) ---

568 struct {
569 short fd; /* Used when thread waiting on fd */
570 short branch; /* Line number, for debugging. */
571 char *fname; /* Source file name for debugging.*/
572 } fd;
573 FILE *fp;
574 struct pthread_poll_data *poll_data;
575 spinlock_t *spinlock;
407 SUSP_NOWAIT, /* Suspended, was in a mutex or condition queue. */
408 SUSP_MUTEX_WAIT,/* Suspended, still in a mutex queue. */
409 SUSP_COND_WAIT /* Suspended, still in a condition queue. */
410};
411
412/*
413 * Miscellaneous definitions.
414 */

--- 154 unchanged lines hidden (view full) ---

569 struct {
570 short fd; /* Used when thread waiting on fd */
571 short branch; /* Line number, for debugging. */
572 char *fname; /* Source file name for debugging.*/
573 } fd;
574 FILE *fp;
575 struct pthread_poll_data *poll_data;
576 spinlock_t *spinlock;
576 struct pthread *thread;
577};
578
579/*
580 * Define a continuation routine that can be used to perform a
581 * transfer of control:
582 */
583typedef void (*thread_continuation_t) (void *);
584

--- 165 unchanged lines hidden (view full) ---

750 int timeout;
751
752 /*
753 * Error variable used instead of errno. The function __error()
754 * returns a pointer to this.
755 */
756 int error;
757
577};
578
579/*
580 * Define a continuation routine that can be used to perform a
581 * transfer of control:
582 */
583typedef void (*thread_continuation_t) (void *);
584

--- 165 unchanged lines hidden (view full) ---

750 int timeout;
751
752 /*
753 * Error variable used instead of errno. The function __error()
754 * returns a pointer to this.
755 */
756 int error;
757
758 /* Join queue head and link for waiting threads: */
759 TAILQ_HEAD(join_head, pthread) join_queue;
758 /* Pointer to a thread that is waiting to join (NULL if no joiner). */
759 struct pthread *joiner;
760
761 /*
762 * The current thread can belong to only one scheduling queue at
763 * a time (ready or waiting queue). It can also belong to:
764 *
765 * o A queue of threads waiting for a mutex
766 * o A queue of threads waiting for a condition variable
760
761 /*
762 * The current thread can belong to only one scheduling queue at
763 * a time (ready or waiting queue). It can also belong to:
764 *
765 * o A queue of threads waiting for a mutex
766 * o A queue of threads waiting for a condition variable
767 * o A queue of threads waiting for another thread to terminate
768 * (the join queue above)
769 * o A queue of threads waiting for a file descriptor lock
770 * o A queue of threads needing work done by the kernel thread
771 * (waiting for a spinlock or file I/O)
772 *
767 * o A queue of threads waiting for a file descriptor lock
768 * o A queue of threads needing work done by the kernel thread
769 * (waiting for a spinlock or file I/O)
770 *
773 * It is possible for a thread to belong to more than one of the
774 * above queues if it is handling a signal. A thread may only
775 * enter a mutex, condition variable, or join queue when it is
776 * not being called from a signal handler. If a thread is a
771 * A thread can also be joining a thread (the joiner field above).
772 *
773 * It must not be possible for a thread to belong to any of the
774 * above queues while it is handling a signal. Signal handlers
775 * may longjmp back to previous stack frames circumventing normal
776 * control flow. This could corrupt queue integrity if the thread
777 * retains membership in the queue. Therefore, if a thread is a
777 * member of one of these queues when a signal handler is invoked,
778 * member of one of these queues when a signal handler is invoked,
778 * it must remain in the queue. For this reason, the links for
779 * these queues must not be (re)used for other queues.
779 * it must remove itself from the queue before calling the signal
780 * handler and reinsert itself after normal return of the handler.
780 *
781 * Use pqe for the scheduling queue link (both ready and waiting),
781 *
782 * Use pqe for the scheduling queue link (both ready and waiting),
782 * sqe for synchronization (mutex, condition variable, and join)
783 * queue links, and qe for all other links.
783 * sqe for synchronization (mutex and condition variable) queue
784 * links, and qe for all other links.
784 */
785 TAILQ_ENTRY(pthread) pqe; /* priority queue link */
786 TAILQ_ENTRY(pthread) sqe; /* synchronization queue link */
787 TAILQ_ENTRY(pthread) qe; /* all other queues link */
788
789 /* Wait data. */
790 union pthread_wait_data data;
791

--- 29 unchanged lines hidden (view full) ---

821#define PTHREAD_EXITING 0x0002
822#define PTHREAD_FLAGS_IN_WAITQ 0x0004 /* in waiting queue using pqe link */
823#define PTHREAD_FLAGS_IN_PRIOQ 0x0008 /* in priority queue using pqe link */
824#define PTHREAD_FLAGS_IN_WORKQ 0x0010 /* in work queue using qe link */
825#define PTHREAD_FLAGS_IN_FILEQ 0x0020 /* in file lock queue using qe link */
826#define PTHREAD_FLAGS_IN_FDQ 0x0040 /* in fd lock queue using qe link */
827#define PTHREAD_FLAGS_IN_CONDQ 0x0080 /* in condition queue using sqe link*/
828#define PTHREAD_FLAGS_IN_MUTEXQ 0x0100 /* in mutex queue using sqe link */
785 */
786 TAILQ_ENTRY(pthread) pqe; /* priority queue link */
787 TAILQ_ENTRY(pthread) sqe; /* synchronization queue link */
788 TAILQ_ENTRY(pthread) qe; /* all other queues link */
789
790 /* Wait data. */
791 union pthread_wait_data data;
792

--- 29 unchanged lines hidden (view full) ---

822#define PTHREAD_EXITING 0x0002
823#define PTHREAD_FLAGS_IN_WAITQ 0x0004 /* in waiting queue using pqe link */
824#define PTHREAD_FLAGS_IN_PRIOQ 0x0008 /* in priority queue using pqe link */
825#define PTHREAD_FLAGS_IN_WORKQ 0x0010 /* in work queue using qe link */
826#define PTHREAD_FLAGS_IN_FILEQ 0x0020 /* in file lock queue using qe link */
827#define PTHREAD_FLAGS_IN_FDQ 0x0040 /* in fd lock queue using qe link */
828#define PTHREAD_FLAGS_IN_CONDQ 0x0080 /* in condition queue using sqe link*/
829#define PTHREAD_FLAGS_IN_MUTEXQ 0x0100 /* in mutex queue using sqe link */
829#define PTHREAD_FLAGS_IN_JOINQ 0x0200 /* in join queue using sqe link */
830#define PTHREAD_FLAGS_TRACE 0x0400 /* for debugging purposes */
830#define PTHREAD_FLAGS_TRACE 0x0200 /* for debugging purposes */
831#define PTHREAD_FLAGS_IN_SYNCQ \
831#define PTHREAD_FLAGS_IN_SYNCQ \
832 (PTHREAD_FLAGS_IN_CONDQ | PTHREAD_FLAGS_IN_MUTEXQ | PTHREAD_FLAGS_IN_JOINQ)
832 (PTHREAD_FLAGS_IN_CONDQ | PTHREAD_FLAGS_IN_MUTEXQ)
833
834 /*
835 * Base priority is the user setable and retrievable priority
836 * of the thread. It is only affected by explicit calls to
837 * set thread priority and upon thread creation via a thread
838 * attribute or default priority.
839 */
840 char base_priority;

--- 365 unchanged lines hidden (view full) ---

1206char *__ttyname_r_basic(int, char *, size_t);
1207char *ttyname_r(int, char *, size_t);
1208void _cond_wait_backout(pthread_t);
1209void _fd_lock_backout(pthread_t);
1210int _find_dead_thread(pthread_t);
1211int _find_thread(pthread_t);
1212struct pthread *_get_curthread(void);
1213void _set_curthread(struct pthread *);
833
834 /*
835 * Base priority is the user setable and retrievable priority
836 * of the thread. It is only affected by explicit calls to
837 * set thread priority and upon thread creation via a thread
838 * attribute or default priority.
839 */
840 char base_priority;

--- 365 unchanged lines hidden (view full) ---

1206char *__ttyname_r_basic(int, char *, size_t);
1207char *ttyname_r(int, char *, size_t);
1208void _cond_wait_backout(pthread_t);
1209void _fd_lock_backout(pthread_t);
1210int _find_dead_thread(pthread_t);
1211int _find_thread(pthread_t);
1212struct pthread *_get_curthread(void);
1213void _set_curthread(struct pthread *);
1214void _join_backout(pthread_t);
1215int _thread_create(pthread_t *,const pthread_attr_t *,void *(*start_routine)(void *),void *,pthread_t);
1216int _thread_fd_lock(int, int, struct timespec *);
1217int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno);
1218int _mutex_cv_lock(pthread_mutex_t *);
1219int _mutex_cv_unlock(pthread_mutex_t *);
1220void _mutex_lock_backout(pthread_t);
1221void _mutex_notify_priochange(pthread_t);
1222int _mutex_reinit(pthread_mutex_t *);

--- 193 unchanged lines hidden ---
1214int _thread_create(pthread_t *,const pthread_attr_t *,void *(*start_routine)(void *),void *,pthread_t);
1215int _thread_fd_lock(int, int, struct timespec *);
1216int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno);
1217int _mutex_cv_lock(pthread_mutex_t *);
1218int _mutex_cv_unlock(pthread_mutex_t *);
1219void _mutex_lock_backout(pthread_t);
1220void _mutex_notify_priochange(pthread_t);
1221int _mutex_reinit(pthread_mutex_t *);

--- 193 unchanged lines hidden ---