diff options
Diffstat (limited to 'src/xine-engine/utils.c')
-rw-r--r-- | src/xine-engine/utils.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/xine-engine/utils.c b/src/xine-engine/utils.c index 50d5cc482..3f45e909c 100644 --- a/src/xine-engine/utils.c +++ b/src/xine-engine/utils.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.2 2001/06/21 17:34:24 guenter Exp $ + * $Id: utils.c,v 1.3 2001/09/06 13:29:18 jkeil Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -32,6 +32,7 @@ #include <string.h> #include <unistd.h> #include <pwd.h> +#include <time.h> #include <sys/types.h> /* @@ -125,3 +126,20 @@ char *chomp(char *str) { return pbuf; } + + +/* + * A thread-safe usecond sleep + */ +void xine_usec_sleep(unsigned usec) { +#if HAVE_NANOSLEEP + /* nanosleep is prefered on solaris, because it's mt-safe */ + struct timespec ts; + + ts.tv_sec = usec / 1000000; + ts.tv_nsec = (usec % 1000000) * 1000; + nanosleep(&ts, NULL); +#else + usleep(usec); +#endif +} |