2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1997-2009 Oracle. All rights reserved.
13 /* vxworks API to get system clock rate */
14 int sysClkRateGet (void);
18 * Yield the processor, optionally pausing until running again.
21 __os_yield(env, secs, usecs)
23 u_long secs, usecs; /* Seconds and microseconds. */
25 int ticks_delay, ticks_per_second;
29 /* Don't require the values be normalized. */
30 for (; usecs >= US_PER_SEC; usecs -= US_PER_SEC)
34 * Yield the processor so other processes or threads can run.
36 * As a side effect, taskDelay() moves the calling task to the end of
37 * the ready queue for tasks of the same priority. In particular, you
38 * can yield the CPU to any other tasks of the same priority by
39 * "delaying" for zero clock ticks.
41 * Never wait less than a tick, if we were supposed to wait at all.
43 ticks_per_second = sysClkRateGet();
45 secs * ticks_per_second + (usecs * ticks_per_second) / US_PER_SEC;
46 if (ticks_delay == 0 && (secs != 0 || usecs != 0))
48 (void)taskDelay(ticks_delay);