resetting manifest requested domain to floor
[platform/upstream/db4.git] / os_brew / os_yield.c
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1997-2009 Oracle.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 #include "db_config.h"
10
11 #include "db_int.h"
12
13 /*
14  * __os_yield --
15  *      Yield the processor, optionally pausing until running again.
16  */
17 void
18 __os_yield(env, secs, usecs)
19         ENV *env;
20         u_long secs, usecs;             /* Seconds and microseconds. */
21 {
22         COMPQUIET(env, NULL);
23
24 #ifdef HAVE_BREW_SDK2
25         COMPQUIET(secs, 0);
26         COMPQUIET(usecs, 0);
27 #else
28         /* Don't require the values be normalized. */
29         for (; usecs >= US_PER_SEC; usecs -= US_PER_SEC)
30                 ++secs;
31
32         /*
33          * Yield the processor so other processes or threads can run.
34          *
35          * Sheer raving paranoia -- don't sleep for 0 time, in case some
36          * implementation doesn't yield the processor in that case.
37          */
38         MSLEEP(secs * MS_PER_SEC + (usecs / US_PER_MS) + 1);
39 #endif
40 }