diff options
Diffstat (limited to 'db-4.8.30/os_windows/os_yield.c')
-rw-r--r-- | db-4.8.30/os_windows/os_yield.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/db-4.8.30/os_windows/os_yield.c b/db-4.8.30/os_windows/os_yield.c new file mode 100644 index 0000000..3d07386 --- /dev/null +++ b/db-4.8.30/os_windows/os_yield.c @@ -0,0 +1,35 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2009 Oracle. All rights reserved. + * + * $Id$ + */ + +#include "db_config.h" + +#include "db_int.h" + +/* + * __os_yield -- + * Yield the processor, optionally pausing until running again. + */ +void +__os_yield(env, secs, usecs) + ENV *env; + u_long secs, usecs; /* Seconds and microseconds. */ +{ + COMPQUIET(env, NULL); + + /* Don't require the values be normalized. */ + for (; usecs >= US_PER_SEC; usecs -= US_PER_SEC) + ++secs; + + /* + * Yield the processor so other processes or threads can run. + * + * Sheer raving paranoia -- don't sleep for 0 time, in case some + * implementation doesn't yield the processor in that case. + */ + Sleep(secs * MS_PER_SEC + (usecs / US_PER_MS) + 1); +} |