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)
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)
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;
tv.tv_usec = microseconds % G_USEC_PER_SEC;
select(0, NULL, NULL, NULL, &tv);
}
+# endif /* !HAVE_NSLEEP */
# endif /* !HAVE_NANOSLEEP */
#endif /* !G_OS_WIN32 */
}