Back to index

glibc  2.9
Functions
usleep.c File Reference
#include <errno.h>
#include <mach.h>
#include <sys/time.h>
#include <unistd.h>

Go to the source code of this file.

Functions

int usleep (useconds_t useconds)

Function Documentation

int usleep ( useconds_t  useconds)

Definition at line 26 of file usleep.c.

{
  mach_port_t recv;
  struct timeval before, after;

  recv = __mach_reply_port ();

  if (__gettimeofday (&before, NULL) < 0)
    return -1;
  (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
                   0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
  __mach_port_destroy (mach_task_self (), recv);
  if (__gettimeofday (&after, NULL) < 0)
    return -1;

  return 0;
}

Here is the call graph for this function: