4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 #include "thr_uberdata.h"
29 #include <sys/types.h>
33 #include <sys/synch32.h>
37 _lwp_cond_wait(cond_t
*cv
, mutex_t
*mp
)
41 error
= ___lwp_cond_wait(cv
, mp
, NULL
, 0);
42 if (mp
->mutex_type
& (PTHREAD_PRIO_INHERIT
|PTHREAD_PRIO_PROTECT
))
43 (void) ___lwp_mutex_timedlock(mp
, NULL
, NULL
);
45 (void) _lwp_mutex_lock(mp
);
50 _lwp_cond_reltimedwait(cond_t
*cv
, mutex_t
*mp
, timespec_t
*relts
)
55 (relts
->tv_sec
< 0 || (ulong_t
)relts
->tv_nsec
>= NANOSEC
))
57 error
= ___lwp_cond_wait(cv
, mp
, relts
, 0);
58 if (mp
->mutex_type
& (PTHREAD_PRIO_INHERIT
|PTHREAD_PRIO_PROTECT
))
59 (void) ___lwp_mutex_timedlock(mp
, NULL
, NULL
);
61 (void) _lwp_mutex_lock(mp
);
66 _lwp_cond_timedwait(cond_t
*cv
, mutex_t
*mp
, timespec_t
*absts
)
68 extern void abstime_to_reltime(clockid_t
,
69 const timespec_t
*, timespec_t
*);
72 abstime_to_reltime(CLOCK_REALTIME
, absts
, &tslocal
);
73 return (_lwp_cond_reltimedwait(cv
, mp
, &tslocal
));