Deleted Added
full compact
thr_private.h (19631) thr_private.h (22315)
1/*
2 * Copyright (c) 1995 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

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

54#include <sys/time.h>
55
56/*
57 * Kernel fatal error handler macro.
58 */
59#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
60
61/*
1/*
2 * Copyright (c) 1995 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

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

54#include <sys/time.h>
55
56/*
57 * Kernel fatal error handler macro.
58 */
59#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
60
61/*
62 * State change macro:
63 */
64#define PTHREAD_NEW_STATE(thrd, newstate) { \
65 (thrd)->state = newstate; \
66 (thrd)->fname = __FILE__; \
67 (thrd)->lineno = __LINE__; \
68}
69
70/*
62 * Queue definitions.
63 */
64struct pthread_queue {
65 struct pthread *q_next;
66 struct pthread *q_last;
67 void *q_data;
68};
69

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

201 */
202#define INC_PRIO_USEC 500000
203
204/*
205 * Time slice period in microseconds.
206 */
207#define TIMESLICE_USEC 100000
208
71 * Queue definitions.
72 */
73struct pthread_queue {
74 struct pthread *q_next;
75 struct pthread *q_last;
76 void *q_data;
77};
78

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

210 */
211#define INC_PRIO_USEC 500000
212
213/*
214 * Time slice period in microseconds.
215 */
216#define TIMESLICE_USEC 100000
217
209/*
210 * Flags.
211 */
212#define PTHREAD_DETACHED 0x1
213#define PTHREAD_SCOPE_SYSTEM 0x2
214#define PTHREAD_INHERIT_SCHED 0x4
215#define PTHREAD_NOFLOAT 0x8
216
217#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED
218#define PTHREAD_CREATE_JOINABLE 0
219#define PTHREAD_SCOPE_PROCESS 0
220#define PTHREAD_EXPLICIT_SCHED 0
221
222struct pthread_key {
223 pthread_mutex_t mutex;
224 long count;
225 void (*destructor) ();
226};
227
228/*
229 * Thread states.

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

402 struct pthread_queue *queue;
403
404 /* Pointer to next element in queue. */
405 struct pthread *qnxt;
406
407 /* Wait data. */
408 union pthread_wait_data data;
409
218struct pthread_key {
219 pthread_mutex_t mutex;
220 long count;
221 void (*destructor) ();
222};
223
224/*
225 * Thread states.

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

398 struct pthread_queue *queue;
399
400 /* Pointer to next element in queue. */
401 struct pthread *qnxt;
402
403 /* Wait data. */
404 union pthread_wait_data data;
405
406 /*
407 * Set to TRUE if a blocking operation was
408 * interrupted by a signal:
409 */
410 int interrupted;
411
412 /* Signal number when in state PS_SIGWAIT: */
413 int signo;
414
410 /* Miscellaneous data. */
411 char flags;
412 char pthread_priority;
413 void *ret;
414 const void **specific_data;
415 int specific_data_count;
416
417 /* Cleanup handlers Link List */
418 struct pthread_cleanup *cleanup;
415 /* Miscellaneous data. */
416 char flags;
417 char pthread_priority;
418 void *ret;
419 const void **specific_data;
420 int specific_data_count;
421
422 /* Cleanup handlers Link List */
423 struct pthread_cleanup *cleanup;
424 char *fname; /* Ptr to source file name */
425 int lineno; /* Source line number. */
419};
420
421/*
422 * Global variables for the uthread kernel.
423 */
424
425/* Kernel thread structure used when there are no running threads: */
426SCLASS struct pthread _thread_kern_thread;
427
428/* Ptr to the thread structure for the running thread: */
426};
427
428/*
429 * Global variables for the uthread kernel.
430 */
431
432/* Kernel thread structure used when there are no running threads: */
433SCLASS struct pthread _thread_kern_thread;
434
435/* Ptr to the thread structure for the running thread: */
429SCLASS struct pthread *_thread_run
436SCLASS struct pthread * volatile _thread_run
430#ifdef GLOBAL_PTHREAD_PRIVATE
431= &_thread_kern_thread;
432#else
433;
434#endif
435
436/*
437 * Ptr to the thread running in single-threaded mode or NULL if
438 * running multi-threaded (default POSIX behaviour).
439 */
437#ifdef GLOBAL_PTHREAD_PRIVATE
438= &_thread_kern_thread;
439#else
440;
441#endif
442
443/*
444 * Ptr to the thread running in single-threaded mode or NULL if
445 * running multi-threaded (default POSIX behaviour).
446 */
440SCLASS struct pthread *_thread_single
447SCLASS struct pthread * volatile _thread_single
441#ifdef GLOBAL_PTHREAD_PRIVATE
442= NULL;
443#else
444;
445#endif
446
447/* Ptr to the first thread in the thread linked list: */
448#ifdef GLOBAL_PTHREAD_PRIVATE
449= NULL;
450#else
451;
452#endif
453
454/* Ptr to the first thread in the thread linked list: */
448SCLASS struct pthread *_thread_link_list
455SCLASS struct pthread * volatile _thread_link_list
449#ifdef GLOBAL_PTHREAD_PRIVATE
450= NULL;
451#else
452;
453#endif
454
455/*
456 * Array of kernel pipe file descriptors that are used to ensure that

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

476SCLASS struct timeval kern_inc_prio_time
477#ifdef GLOBAL_PTHREAD_PRIVATE
478= { 0, 0 };
479#else
480;
481#endif
482
483/* Dead threads: */
456#ifdef GLOBAL_PTHREAD_PRIVATE
457= NULL;
458#else
459;
460#endif
461
462/*
463 * Array of kernel pipe file descriptors that are used to ensure that

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

483SCLASS struct timeval kern_inc_prio_time
484#ifdef GLOBAL_PTHREAD_PRIVATE
485= { 0, 0 };
486#else
487;
488#endif
489
490/* Dead threads: */
484SCLASS struct pthread *_thread_dead
491SCLASS struct pthread * volatile _thread_dead
485#ifdef GLOBAL_PTHREAD_PRIVATE
486= NULL;
487#else
488;
489#endif
490
491/* Initial thread: */
492SCLASS struct pthread *_thread_initial

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

500SCLASS struct pthread_attr pthread_attr_default
501#ifdef GLOBAL_PTHREAD_PRIVATE
502= { SCHED_RR, PTHREAD_DEFAULT_PRIORITY, PTHREAD_CREATE_RUNNING,
503 PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, PTHREAD_STACK_DEFAULT };
504#else
505;
506#endif
507
492#ifdef GLOBAL_PTHREAD_PRIVATE
493= NULL;
494#else
495;
496#endif
497
498/* Initial thread: */
499SCLASS struct pthread *_thread_initial

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

507SCLASS struct pthread_attr pthread_attr_default
508#ifdef GLOBAL_PTHREAD_PRIVATE
509= { SCHED_RR, PTHREAD_DEFAULT_PRIORITY, PTHREAD_CREATE_RUNNING,
510 PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, PTHREAD_STACK_DEFAULT };
511#else
512;
513#endif
514
508/* Default thread attributes: */
515/* Default mutex attributes: */
509SCLASS struct pthread_mutex_attr pthread_mutexattr_default
510#ifdef GLOBAL_PTHREAD_PRIVATE
511= { MUTEX_TYPE_FAST, 0 };
512#else
513;
514#endif
515
516SCLASS struct pthread_mutex_attr pthread_mutexattr_default
517#ifdef GLOBAL_PTHREAD_PRIVATE
518= { MUTEX_TYPE_FAST, 0 };
519#else
520;
521#endif
522
523/* Default condition variable attributes: */
524SCLASS struct pthread_cond_attr pthread_condattr_default
525#ifdef GLOBAL_PTHREAD_PRIVATE
526= { COND_TYPE_FAST, 0 };
527#else
528;
529#endif
530
531/*
532 * Standard I/O file descriptors need special flag treatment since
533 * setting one to non-blocking does all on *BSD. Sigh. This array
534 * is used to store the initial flag settings.
535 */
536SCLASS int _pthread_stdio_flags[3];
537
516/* File table information: */
517SCLASS struct fd_table_entry **_thread_fd_table
518#ifdef GLOBAL_PTHREAD_PRIVATE
519= NULL;
520#else
521;
522#endif
523

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

553void _thread_cleanupspecific(void);
554void _thread_dump_info(void);
555void _thread_init(void);
556void _thread_kern_sched(struct sigcontext *);
557void _thread_kern_sched_state(enum pthread_state,char *fname,int lineno);
558void _thread_kern_set_timeout(struct timespec *);
559void _thread_kern_sig_block(int *);
560void _thread_kern_sig_unblock(int);
538/* File table information: */
539SCLASS struct fd_table_entry **_thread_fd_table
540#ifdef GLOBAL_PTHREAD_PRIVATE
541= NULL;
542#else
543;
544#endif
545

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

575void _thread_cleanupspecific(void);
576void _thread_dump_info(void);
577void _thread_init(void);
578void _thread_kern_sched(struct sigcontext *);
579void _thread_kern_sched_state(enum pthread_state,char *fname,int lineno);
580void _thread_kern_set_timeout(struct timespec *);
581void _thread_kern_sig_block(int *);
582void _thread_kern_sig_unblock(int);
561void _thread_cleanup_pop(int);
562void _thread_sig_handler(int, int, struct sigcontext *);
563void _thread_start(void);
564void _thread_start_sig_handler(void);
565void _thread_seterrno(pthread_t,int);
566void _thread_queue_init(struct pthread_queue *);
567void _thread_queue_enq(struct pthread_queue *, struct pthread *);
568int _thread_queue_remove(struct pthread_queue *, struct pthread *);
569int _thread_fd_table_init(int fd);

--- 194 unchanged lines hidden ---
583void _thread_sig_handler(int, int, struct sigcontext *);
584void _thread_start(void);
585void _thread_start_sig_handler(void);
586void _thread_seterrno(pthread_t,int);
587void _thread_queue_init(struct pthread_queue *);
588void _thread_queue_enq(struct pthread_queue *, struct pthread *);
589int _thread_queue_remove(struct pthread_queue *, struct pthread *);
590int _thread_fd_table_init(int fd);

--- 194 unchanged lines hidden ---