From: Matthias Clasen Date: Tue, 27 May 2008 16:00:51 +0000 (+0000) Subject: Revert the patch for bug 527214 and related changes. GTimer X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=689a9e4b1a3587f098ca464ba6929448bf27e362;p=dana%2Fcg-glib.git Revert the patch for bug 527214 and related changes. GTimer is supposed to work without threads. svn path=/trunk/; revision=6943 --- diff --git a/ChangeLog b/ChangeLog index 636ef041..8eab6f64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 Matthias Clasen + + * Revert the patch for bug 527214 and related changes. GTimer + is supposed to work without threads. + 2008-05-27 simon.zheng * configure.in: Fix #533369. Check whether memeber statvfs.f_basetype diff --git a/docs/reference/glib/tmpl/threads.sgml b/docs/reference/glib/tmpl/threads.sgml index f0c59d0f..3cbbbfcc 100644 --- a/docs/reference/glib/tmpl/threads.sgml +++ b/docs/reference/glib/tmpl/threads.sgml @@ -162,20 +162,22 @@ the thread system by calling g_thread_init(). Most of the time you will only have to call g_thread_init (NULL). - - + Do not call g_thread_init() with a non-%NULL parameter unless you really know what you are doing. - - + - - + g_thread_init() must not be called directly or indirectly as a callback from GLib. Also no mutexes may be currently locked while calling g_thread_init(). - - + + + +g_thread_init() changes the way in which #GTimer measures elapsed time. +As a consequence, timers that are running while g_thread_init() is called +may report unreliable times. + g_thread_init() might only be called once. On the second call diff --git a/docs/reference/glib/tmpl/timers.sgml b/docs/reference/glib/tmpl/timers.sgml index 52290955..8e3cfa80 100644 --- a/docs/reference/glib/tmpl/timers.sgml +++ b/docs/reference/glib/tmpl/timers.sgml @@ -11,8 +11,10 @@ This is done somewhat differently on different platforms, and can be tricky to get exactly right, so #GTimer provides a portable/convenient interface. -#GTimer internally uses the threading API. Therefore g_thread_init() has to be -called before creating #GTimer instances. +#GTimer uses a higher-quality clock when thread support is available. +Therefore, calling g_thread_init() while timers are running may lead to +unreliable results. It is best to call g_thread_init() before starting +any timers, if you are using threads at all. @@ -34,9 +36,6 @@ Opaque datatype that records a start time. Creates a new timer, and starts timing (i.e. g_timer_start() is implicitly called for you). - -Call g_thread_init() before using this function. - @Returns: a new #GTimer. diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index 8f2bb83f..6f3c6502 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -12,7 +12,6 @@ INCLUDES = \ noinst_PROGRAMS = $(TEST_PROGS) progs_ldadd = \ $(top_builddir)/glib/libglib-2.0.la \ - $(top_builddir)/gthread/libgthread-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gio/libgio-2.0.la diff --git a/gio/tests/data-input-stream.c b/gio/tests/data-input-stream.c index b979066a..6abc7c47 100644 --- a/gio/tests/data-input-stream.c +++ b/gio/tests/data-input-stream.c @@ -318,7 +318,6 @@ main (int argc, char *argv[]) { g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); g_test_add_func ("/data-input-stream/read-lines-LF", test_read_lines_LF); diff --git a/gio/tests/data-output-stream.c b/gio/tests/data-output-stream.c index 56edbfdd..1a7e1ae8 100644 --- a/gio/tests/data-output-stream.c +++ b/gio/tests/data-output-stream.c @@ -282,7 +282,6 @@ main (int argc, char *argv[]) { g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); g_test_add_func ("/data-input-stream/read-lines-LF", test_read_lines_LF); diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c index edbd3193..d3ed5c98 100644 --- a/gio/tests/g-file-info.c +++ b/gio/tests/g-file-info.c @@ -117,7 +117,6 @@ main (int argc, char *argv[]) { g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); g_test_add_func ("/g-file-info/test_g_file_info", test_g_file_info); diff --git a/gio/tests/g-file.c b/gio/tests/g-file.c index 26186313..d512c930 100644 --- a/gio/tests/g-file.c +++ b/gio/tests/g-file.c @@ -507,7 +507,6 @@ main (int argc, char *argv[]) { g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); diff --git a/gio/tests/live-g-file.c b/gio/tests/live-g-file.c index a5ece7f8..203fcb27 100644 --- a/gio/tests/live-g-file.c +++ b/gio/tests/live-g-file.c @@ -1107,7 +1107,6 @@ main (int argc, char *argv[]) /* strip all gtester-specific args */ g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); /* no extra parameters specified, assume we're executed from glib test suite */ diff --git a/gio/tests/memory-input-stream.c b/gio/tests/memory-input-stream.c index de3f661c..247613c6 100644 --- a/gio/tests/memory-input-stream.c +++ b/gio/tests/memory-input-stream.c @@ -70,7 +70,6 @@ main (int argc, char *argv[]) { g_type_init (); - g_thread_init (0); g_test_init (&argc, &argv, NULL); g_test_add_func ("/memory-input-stream/read-chunks", test_read_chunks); diff --git a/glib/Makefile.am b/glib/Makefile.am index 0be005da..fbdf900b 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -316,7 +316,7 @@ if OS_UNIX INSTALL_PROGS += gtester gtester_SOURCES = gtester.c -gtester_LDADD = libglib-2.0.la +gtester_LDADD = libglib-2.0.la auto_config_binscripts = gtester-report bin_SCRIPTS = ${auto_config_binscripts} diff --git a/glib/gtimer.c b/glib/gtimer.c index 83f45ee3..a29e39dd 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -69,10 +69,6 @@ g_timer_new (void) { GTimer *timer; - if (!g_thread_supported ()) - g_warning ("g_timer_new() called, but GThreads not initialized yet. " - "Call g_thread_init ()."); - timer = g_new (GTimer, 1); timer->active = TRUE; diff --git a/glib/pcre/Makefile.am b/glib/pcre/Makefile.am index c5aedb67..bbea2e49 100644 --- a/glib/pcre/Makefile.am +++ b/glib/pcre/Makefile.am @@ -62,3 +62,5 @@ EXTRA_DIST = \ COPYING \ makefile.msc +# automake workaround +test: diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am index 62b7ee72..26f6d37a 100644 --- a/glib/tests/Makefile.am +++ b/glib/tests/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl INCLUDES = -g -I$(top_srcdir) -I$(top_srcdir)/glib $(GLIB_DEBUG_FLAGS) noinst_PROGRAMS = $(TEST_PROGS) -progs_ldadd = $(top_builddir)/glib/libglib-2.0.la +progs_ldadd = $(top_builddir)/glib/libglib-2.0.la TEST_PROGS += testing