2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1997-2001
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id: os_sleep.c,v 11.9 2001/01/31 14:16:19 bostic Exp $";
14
#ifndef NO_SYSTEM_INCLUDES
15
#include <sys/types.h>
17
#ifdef HAVE_SYS_SELECT_H
18
#include <sys/select.h>
22
#include <sys/times.h>
25
#if TIME_WITH_SYS_TIME
33
#endif /* HAVE_SYS_TIME_H */
34
#endif /* TIME_WITH SYS_TIME */
35
#endif /* HAVE_VXWORKS */
46
* Yield the processor for a period of time.
48
* PUBLIC: int __os_sleep __P((DB_ENV *, u_long, u_long));
51
__os_sleep(dbenv, secs, usecs)
53
u_long secs, usecs; /* Seconds and microseconds. */
58
/* Don't require that the values be normalized. */
59
for (; usecs >= 1000000; usecs -= 1000000)
62
if (__db_jump.j_sleep != NULL)
63
return (__db_jump.j_sleep(secs, usecs));
66
* It's important that we yield the processor here so that other
67
* processes or threads are permitted to run.
71
ret = select(0, NULL, NULL, NULL, &t) == -1 ? __os_get_errno() : 0;
74
__db_err(dbenv, "select: %s", strerror(ret));