thr_private.h (125966) | thr_private.h (126000) |
---|---|
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/libthr/thread/thr_private.h 125966 2004-02-18 15:16:31Z mtm $ | 34 * $FreeBSD: head/lib/libthr/thread/thr_private.h 126000 2004-02-19 13:51:52Z mtm $ |
35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Evaluate the storage class specifier. 42 */ --- 98 unchanged lines hidden (view full) --- 141#define PTHREAD_NEW_STATE(thrd, newstate) do { \ 142 if (newstate == PS_RUNNING) { \ 143 if (thr_kill(thrd->thr_id, SIGTHR)) \ 144 abort(); \ 145 } \ 146 PTHREAD_SET_STATE(thrd, newstate); \ 147} while (0) 148 | 35 */ 36 37#ifndef _THR_PRIVATE_H 38#define _THR_PRIVATE_H 39 40/* 41 * Evaluate the storage class specifier. 42 */ --- 98 unchanged lines hidden (view full) --- 141#define PTHREAD_NEW_STATE(thrd, newstate) do { \ 142 if (newstate == PS_RUNNING) { \ 143 if (thr_kill(thrd->thr_id, SIGTHR)) \ 144 abort(); \ 145 } \ 146 PTHREAD_SET_STATE(thrd, newstate); \ 147} while (0) 148 |
149 | |
150/* 151 * TailQ initialization values. 152 */ 153#define TAILQ_INITIALIZER { NULL, NULL } 154 155#define UMTX_INITIALIZER { NULL } 156 157struct pthread_mutex_attr { --- 205 unchanged lines hidden (view full) --- 363 364/* 365 * XXX Define a thread-safe macro to get the current time of day 366 * which is updated at regular intervals by the scheduling signal 367 * handler. 368 */ 369#define GET_CURRENT_TOD(tv) gettimeofday(&(tv), NULL) 370 | 149/* 150 * TailQ initialization values. 151 */ 152#define TAILQ_INITIALIZER { NULL, NULL } 153 154#define UMTX_INITIALIZER { NULL } 155 156struct pthread_mutex_attr { --- 205 unchanged lines hidden (view full) --- 362 363/* 364 * XXX Define a thread-safe macro to get the current time of day 365 * which is updated at regular intervals by the scheduling signal 366 * handler. 367 */ 368#define GET_CURRENT_TOD(tv) gettimeofday(&(tv), NULL) 369 |
370struct pthread_barrierattr { 371 int ba_pshared; 372}; |
|
371 | 373 |
374/* 375 * POSIX Threads barrier object. 376 * Lock order: 377 * 1. pthread_barrier 378 * 2. pthread 379 */ 380struct pthread_barrier { 381 TAILQ_HEAD(barrq_head, pthread) b_barrq; 382 struct umtx b_lock; 383 int b_total; 384 int b_subtotal; 385}; 386 |
|
372struct pthread_rwlockattr { 373 int pshared; 374}; 375 376struct pthread_rwlock { 377 pthread_mutex_t lock; /* monitor lock */ 378 int state; /* 0 = idle >0 = # of readers -1 = writer */ 379 pthread_cond_t read_signal; 380 pthread_cond_t write_signal; 381 int blocked_writers; 382}; 383 384/* 385 * Thread states. 386 */ 387enum pthread_state { 388 PS_RUNNING, 389 PS_MUTEX_WAIT, 390 PS_COND_WAIT, | 387struct pthread_rwlockattr { 388 int pshared; 389}; 390 391struct pthread_rwlock { 392 pthread_mutex_t lock; /* monitor lock */ 393 int state; /* 0 = idle >0 = # of readers -1 = writer */ 394 pthread_cond_t read_signal; 395 pthread_cond_t write_signal; 396 int blocked_writers; 397}; 398 399/* 400 * Thread states. 401 */ 402enum pthread_state { 403 PS_RUNNING, 404 PS_MUTEX_WAIT, 405 PS_COND_WAIT, |
406 PS_BARRIER_WAIT, |
|
391 PS_SLEEP_WAIT, /* XXX We need to wrap syscalls to set this state */ 392 PS_WAIT_WAIT, 393 PS_JOIN, 394 PS_DEAD, 395 PS_DEADLOCK, 396 PS_STATE_MAX 397}; 398 --- 131 unchanged lines hidden (view full) --- 530 531 /* Wait data. */ 532 union pthread_wait_data data; 533 534 /* Miscellaneous flags; only set with signals deferred. */ 535 int flags; 536#define PTHREAD_FLAGS_PRIVATE 0x0001 537#define PTHREAD_EXITING 0x0002 | 407 PS_SLEEP_WAIT, /* XXX We need to wrap syscalls to set this state */ 408 PS_WAIT_WAIT, 409 PS_JOIN, 410 PS_DEAD, 411 PS_DEADLOCK, 412 PS_STATE_MAX 413}; 414 --- 131 unchanged lines hidden (view full) --- 546 547 /* Wait data. */ 548 union pthread_wait_data data; 549 550 /* Miscellaneous flags; only set with signals deferred. */ 551 int flags; 552#define PTHREAD_FLAGS_PRIVATE 0x0001 553#define PTHREAD_EXITING 0x0002 |
554#define PTHREAD_FLAGS_BARR_REL 0x0004 /* has been released from barrier */ |
|
538#define PTHREAD_FLAGS_IN_CONDQ 0x0080 /* in condition queue using sqe link*/ 539#define PTHREAD_FLAGS_IN_MUTEXQ 0x0100 /* in mutex queue using sqe link */ 540#define PTHREAD_FLAGS_SUSPENDED 0x0200 /* thread is suspended */ 541#define PTHREAD_FLAGS_TRACE 0x0400 /* for debugging purposes */ 542#define PTHREAD_FLAGS_IN_SYNCQ \ 543 (PTHREAD_FLAGS_IN_CONDQ | PTHREAD_FLAGS_IN_MUTEXQ) 544 545 /* --- 359 unchanged lines hidden --- | 555#define PTHREAD_FLAGS_IN_CONDQ 0x0080 /* in condition queue using sqe link*/ 556#define PTHREAD_FLAGS_IN_MUTEXQ 0x0100 /* in mutex queue using sqe link */ 557#define PTHREAD_FLAGS_SUSPENDED 0x0200 /* thread is suspended */ 558#define PTHREAD_FLAGS_TRACE 0x0400 /* for debugging purposes */ 559#define PTHREAD_FLAGS_IN_SYNCQ \ 560 (PTHREAD_FLAGS_IN_CONDQ | PTHREAD_FLAGS_IN_MUTEXQ) 561 562 /* --- 359 unchanged lines hidden --- |