2003-03-19 23:09:16 +01:00
|
|
|
/*
|
|
|
|
* usleep function
|
|
|
|
*
|
|
|
|
* Copyright 1996 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-03-19 23:09:16 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2003-03-23 21:11:45 +01:00
|
|
|
#include <errno.h>
|
|
|
|
|
2003-03-19 23:09:16 +01:00
|
|
|
#ifndef HAVE_USLEEP
|
|
|
|
int usleep (unsigned int useconds)
|
|
|
|
{
|
|
|
|
#if defined(__EMX__)
|
|
|
|
DosSleep(useconds);
|
|
|
|
return 0;
|
|
|
|
#elif defined(__BEOS__)
|
|
|
|
return snooze(useconds);
|
|
|
|
#elif defined(HAVE_SELECT)
|
|
|
|
struct timeval delay;
|
|
|
|
|
|
|
|
delay.tv_sec = useconds / 1000000;
|
|
|
|
delay.tv_usec = useconds % 1000000;
|
|
|
|
|
|
|
|
select( 0, 0, 0, 0, &delay );
|
|
|
|
return 0;
|
|
|
|
#else /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
|
|
|
|
errno = ENOSYS;
|
|
|
|
return -1;
|
|
|
|
#endif /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
|
|
|
|
}
|
|
|
|
#endif /* HAVE_USLEEP */
|