mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-30 05:43:28 +02:00
Don't link glib against libpthread. (#393812)
2007-01-07 Matthias Clasen <mclasen@redhat.com> Don't link glib against libpthread. (#393812) * configure.in: Link gthread against librt, not glib itself. * glib/gthread.h: * glib/gthread.c: Add a new thread function, gettime. * glib/gtimer.c: Use gettime instead of directly working with the various system interfaces. * gthread/gthread-impl.c: * gthread/gthread-posix.c: * gthread/gthread-win32.c: Implement gettime. svn path=/trunk/; revision=5227
This commit is contained in:
committed by
Matthias Clasen
parent
8a688f12f0
commit
541462ab1e
@@ -38,6 +38,11 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "glib.h"
|
||||
@@ -68,8 +73,9 @@ struct _GStaticPrivateNode
|
||||
GDestroyNotify destroy;
|
||||
};
|
||||
|
||||
static void g_thread_cleanup (gpointer data);
|
||||
static void g_thread_fail (void);
|
||||
static void g_thread_cleanup (gpointer data);
|
||||
static void g_thread_fail (void);
|
||||
static guint64 gettime (void);
|
||||
|
||||
/* Global variables */
|
||||
|
||||
@@ -99,7 +105,9 @@ GThreadFunctions g_thread_functions_for_glib_use = {
|
||||
NULL, /* thread_join */
|
||||
NULL, /* thread_exit */
|
||||
NULL, /* thread_set_priority */
|
||||
NULL /* thread_self */
|
||||
NULL, /* thread_self */
|
||||
NULL, /* thread_equal */
|
||||
gettime /* gettime */
|
||||
};
|
||||
|
||||
/* Local data */
|
||||
@@ -535,6 +543,24 @@ g_thread_fail (void)
|
||||
g_error ("The thread system is not yet initialized.");
|
||||
}
|
||||
|
||||
static guint64
|
||||
gettime (void)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
guint64 v;
|
||||
|
||||
GetSystemTimeAsFileTime ((FILETIME *)&v);
|
||||
|
||||
return v;
|
||||
#else
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
|
||||
return tv.tv_sec * 1e9 + tv.tv_usec * 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gpointer
|
||||
g_thread_create_proxy (gpointer data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user