mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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
This commit is contained in:
parent
3080ebdaa8
commit
088c08a2a5
@ -1,5 +1,10 @@
|
||||
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 */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user