Commit 088c08a2 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Use nsleep to implement g_usleep on AIX. (#321974, Andrew Paprocki)

2006-10-01  Matthias Clasen  <mclasen@redhat.com>

	* glib/gtimer.c (g_usleep): Use nsleep to implement
	g_usleep on AIX.  (#321974, Andrew Paprocki)

	* configure.in: Check for nsleep
parent 3080ebda
2006-10-01 Matthias Clasen <mclasen@redhat.com>
* glib/gtimer.c (g_usleep): Use nsleep to implement
g_usleep on AIX. (#321974, Andrew Paprocki)
* configure.in: Check for nsleep
* glib/gmain.c: Fix typos in doc comments.
(#358421, Tom Tromey)
......
......@@ -855,7 +855,10 @@ fi
AC_MSG_RESULT(unsigned $glib_size_type)
# Check for some functions
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd nanosleep vasprintf setenv unsetenv getc_unlocked readlink symlink)
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink)
# Check for high-resolution sleep functions
AC_CHECK_FUNCS(nanosleep nsleep)
AC_CHECK_FUNCS(clock_gettime, [], [
AC_CHECK_LIB(rt, clock_gettime, [
AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
......
......@@ -323,6 +323,14 @@ g_usleep (gulong microseconds)
while (nanosleep (&request, &remaining) == -1 && errno == EINTR)
request = remaining;
# else /* !HAVE_NANOSLEEP */
# ifdef HAVE_NSLEEP
/* on AIX, nsleep is analogous to nanosleep */
struct timespec request, remaining;
request.tv_sec = microseconds / G_USEC_PER_SEC;
request.tv_nsec = 1000 * (microseconds % G_USEC_PER_SEC);
while (nsleep (&request, &remaining) == -1 && errno == EINTR)
request = remaining;
# else /* !HAVE_NSLEEP */
if (g_thread_supported ())
{
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
......@@ -355,6 +363,7 @@ g_usleep (gulong microseconds)
tv.tv_usec = microseconds % G_USEC_PER_SEC;
select(0, NULL, NULL, NULL, &tv);
}
# endif /* !HAVE_NSLEEP */
# endif /* !HAVE_NANOSLEEP */
#endif /* !G_OS_WIN32 */
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment