/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
* condvar(9f)
*/
/* This is the API we're emulating */
/* avoiding synch.h */
int _lwp_cond_signal(lwp_cond_t *);
int _lwp_cond_broadcast(lwp_cond_t *);
extern clock_t ddi_get_lbolt(void);
{{{0, 0, 0, 0}, USYNC_THREAD, _COND_MAGIC}, 0};
/* ARGSUSED */
void
{
*cv = default_cv;
}
/* ARGSUSED */
void
{
}
void
{
(void) _lwp_cond_signal(cv);
}
void
{
(void) _lwp_cond_broadcast(cv);
}
void
{
}
int
{
}
int
{
int err;
top:
if (err == 0)
return (1);
if (sigok)
return (0);
goto top;
}
return (-1);
}
{
}
{
}
{
}
{
}
/*
* Factored out implementation of all the cv_*timedwait* functions.
* Note that the delta passed in is relative to the (simulated)
* current time reported by ddi_get_lbolt(). Convert that to
* timespec format and keep calling _lwp_cond_reltimedwait,
* which (NB!) decrements that delta in-place!
*/
static clock_t
{
int err;
if (delta <= 0)
return (-1);
top:
return (-1);
switch (err) {
case 0:
return (1);
case EINTR:
if (sigok)
return (0);
goto top;
default:
ASSERT(0);
/* FALLTHROUGH */
case ETIME:
break;
}
return (-1);
}