thr_cond.c (139023) | thr_cond.c (155962) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * | 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 --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $FreeBSD: head/lib/libkse/thread/thr_cond.c 139023 2004-12-18 18:07:37Z deischen $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_cond.c 155962 2006-02-23 21:34:08Z deischen $ |
33 */ 34#include <stdlib.h> 35#include <errno.h> 36#include <string.h> 37#include <pthread.h> 38#include "thr_private.h" 39 40#define THR_IN_CONDQ(thr) (((thr)->sflags & THR_FLAGS_IN_SYNCQ) != 0) --- 375 unchanged lines hidden (view full) --- 416 switch ((*cond)->c_type) { 417 /* Fast condition variable: */ 418 case COND_TYPE_FAST: 419 if ((mutex == NULL) || (((*cond)->c_mutex != NULL) && 420 ((*cond)->c_mutex != *mutex))) { 421 /* Return invalid argument error: */ 422 rval = EINVAL; 423 } else { | 33 */ 34#include <stdlib.h> 35#include <errno.h> 36#include <string.h> 37#include <pthread.h> 38#include "thr_private.h" 39 40#define THR_IN_CONDQ(thr) (((thr)->sflags & THR_FLAGS_IN_SYNCQ) != 0) --- 375 unchanged lines hidden (view full) --- 416 switch ((*cond)->c_type) { 417 /* Fast condition variable: */ 418 case COND_TYPE_FAST: 419 if ((mutex == NULL) || (((*cond)->c_mutex != NULL) && 420 ((*cond)->c_mutex != *mutex))) { 421 /* Return invalid argument error: */ 422 rval = EINVAL; 423 } else { |
424 /* Set the wakeup time: */ 425 curthread->wakeup_time.tv_sec = abstime->tv_sec; 426 curthread->wakeup_time.tv_nsec = 427 abstime->tv_nsec; 428 | |
429 /* Reset the timeout and interrupted flags: */ 430 curthread->timeout = 0; 431 curthread->interrupted = 0; 432 433 /* 434 * Queue the running thread for the condition 435 * variable: 436 */ --- 22 unchanged lines hidden (view full) --- 459 460 /* 461 * This thread is active and is in a 462 * critical region (holding the cv 463 * lock); we should be able to safely 464 * set the state. 465 */ 466 THR_SCHED_LOCK(curthread, curthread); | 424 /* Reset the timeout and interrupted flags: */ 425 curthread->timeout = 0; 426 curthread->interrupted = 0; 427 428 /* 429 * Queue the running thread for the condition 430 * variable: 431 */ --- 22 unchanged lines hidden (view full) --- 454 455 /* 456 * This thread is active and is in a 457 * critical region (holding the cv 458 * lock); we should be able to safely 459 * set the state. 460 */ 461 THR_SCHED_LOCK(curthread, curthread); |
462 /* Set the wakeup time: */ 463 curthread->wakeup_time.tv_sec = 464 abstime->tv_sec; 465 curthread->wakeup_time.tv_nsec = 466 abstime->tv_nsec; |
|
467 THR_SET_STATE(curthread, PS_COND_WAIT); 468 469 /* Remember the CV: */ 470 curthread->data.cond = *cond; 471 curthread->sigbackout = cond_wait_backout; 472 THR_SCHED_UNLOCK(curthread, curthread); 473 474 /* Unlock the CV structure: */ --- 358 unchanged lines hidden --- | 467 THR_SET_STATE(curthread, PS_COND_WAIT); 468 469 /* Remember the CV: */ 470 curthread->data.cond = *cond; 471 curthread->sigbackout = cond_wait_backout; 472 THR_SCHED_UNLOCK(curthread, curthread); 473 474 /* Unlock the CV structure: */ --- 358 unchanged lines hidden --- |