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>
17 #if defined (__i386__) || defined (__x86_64__)
18 #include <xmmintrin.h>
26 runtime_procyield (uint32 cnt
)
30 for (i
= 0; i
< cnt
; ++i
)
32 #if defined (__i386__) || defined (__x86_64__)
38 /* Ask the OS to reschedule this thread. */
40 void runtime_osyield(void)
41 __attribute__ ((no_split_stack
));
44 runtime_osyield (void)
49 /* Sleep for some number of microseconds. */
52 runtime_usleep (uint32 us
)
56 tv
.tv_sec
= us
/ 1000000;
57 tv
.tv_usec
= us
% 1000000;
58 select (0, NULL
, NULL
, NULL
, &tv
);