home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
comm
/
tcp
/
amitcp
/
src
/
netlib
/
usleep.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-04
|
2KB
|
71 lines
RCS_ID_C="$Id: usleep.c,v 1.1 1994/04/04 01:30:50 jraja Exp $"
/*
* usleep.c -- suspend process for the specified time
*
* Author: jraja <Jarno.Rajahalme@hut.fi>
*
* Copyright © 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* Created : Mon Apr 4 00:36:17 1994 jraja
* Last modified:
*
* $Log: usleep.c,v $
* Revision 1.1 1994/04/04 01:30:50 jraja
* Initial revision
*
*/
#include <sys/param.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
/****** net.lib/usleep *********************************************
NAME
usleep - suspend process execution for the specified time
SYNOPSIS
void usleep(unsigned int microseconds);
FUNCTION
Process execution is suspended for number of microseconds
specified in 'microseconds'. The sleep will be aborted if any
of the break signals specified for the process is received
(only CTRL-C by default).
PORTABILITY
UNIX
INPUTS
'microseconds' - number of microseconds to sleep.
RESULT
Does not return a value.
NOTES
The sleep is implemented as a single select() call with all other
than time out argument as NULL.
SEE ALSO
bsdsocket.library/select()
*****************************************************************************
*
*/
void usleep(unsigned int usecs)
{
struct timeval tv;
tv.tv_sec = 0;
while (usecs >= 1000000) {
usecs -= 1000000;
tv.tv_sec++;
}
tv.tv_usec = usecs;
select(0, 0, 0, 0, &tv);
}