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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Copyright (c) 2012 by Delphix. All rights reserved.
33 * definitions for thread synchronization primitives: condition variables
34 * This is the public part of the interface to condition variables. The
35 * private (implementation-specific) part is in <arch>/sys/condvar_impl.h.
38 #ifndef _SYS_CONDVAR_H
39 #define _SYS_CONDVAR_H
42 #include <sys/types.h>
45 #include <sys/mutex.h>
59 typedef struct _kcondvar
{
71 * Time resolution values used in cv_reltimedwait() and cv_reltimedwait_sig()
72 * to specify how accurately a relative timeout must expire - if it can be
73 * anticipated or deferred.
84 extern time_res_t time_res
[];
86 #define TIME_RES_VALID(tr) (tr >= TR_NANOSEC && tr < TR_COUNT)
89 * condition variable function prototypes
92 extern void cv_init(kcondvar_t
*, char *, kcv_type_t
, void *);
93 extern void cv_destroy(kcondvar_t
*);
94 extern void cv_wait(kcondvar_t
*, kmutex_t
*);
95 extern void cv_wait_stop(kcondvar_t
*, kmutex_t
*, int);
96 extern clock_t cv_timedwait(kcondvar_t
*, kmutex_t
*, clock_t);
97 extern clock_t cv_timedwait_hires(kcondvar_t
*, kmutex_t
*, hrtime_t
, hrtime_t
,
99 extern clock_t cv_reltimedwait(kcondvar_t
*, kmutex_t
*, clock_t, time_res_t
);
100 extern int cv_wait_sig(kcondvar_t
*, kmutex_t
*);
101 extern clock_t cv_timedwait_sig(kcondvar_t
*, kmutex_t
*, clock_t);
102 extern int cv_timedwait_sig_hrtime(kcondvar_t
*, kmutex_t
*, hrtime_t
);
103 extern clock_t cv_reltimedwait_sig(kcondvar_t
*, kmutex_t
*, clock_t,
105 extern int cv_wait_sig_swap(kcondvar_t
*, kmutex_t
*);
106 extern int cv_wait_sig_swap_core(kcondvar_t
*, kmutex_t
*, int *);
107 extern void cv_signal(kcondvar_t
*);
108 extern void cv_broadcast(kcondvar_t
*);
109 extern int cv_waituntil_sig(kcondvar_t
*, kmutex_t
*, timestruc_t
*, int);
111 #endif /* defined(_KERNEL) */
119 #endif /* _SYS_CONDVAR_H */