1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 #include <sys/types.h>
15 #ifdef HAVE_SYS_SELECT_H
16 #include <sys/select.h>
24 runtime_procyield (uint32 cnt
)
28 for (i
= 0; i
< cnt
; ++i
)
30 #if defined (__i386__) || defined (__x86_64__)
31 __builtin_ia32_pause ();
36 /* Ask the OS to reschedule this thread. */
39 runtime_osyield (void)
44 /* Sleep for some number of microseconds. */
47 runtime_usleep (uint32 us
)
51 tv
.tv_sec
= us
/ 1000000;
52 tv
.tv_usec
= us
% 1000000;
53 select (0, NULL
, NULL
, NULL
, &tv
);