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.
13 #ifdef HAVE_SYS_SELECT_H
14 #include <sys/select.h>
22 runtime_procyield (uint32 cnt
)
26 for (i
= 0; i
< cnt
; ++i
)
28 #if defined (__i386__) || defined (__x86_64__)
29 __builtin_ia32_pause ();
34 /* Ask the OS to reschedule this thread. */
37 runtime_osyield (void)
42 /* Sleep for some number of microseconds. */
45 runtime_usleep (uint32 us
)
49 tv
.tv_sec
= us
/ 1000000;
50 tv
.tv_usec
= us
% 1000000;
51 select (0, NULL
, NULL
, NULL
, &tv
);