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-Tag: GLIB_2_17_0~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=689a9e4b1a3587f098ca464ba6929448bf27e362;p=platform%2Fupstream%2Fglib.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 636ef04..8eab6f6 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 f0c59d0..3cbbbfc 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 5229095..8e3cfa8 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 8f2bb83..6f3c650 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 b979066..6abc7c4 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 56edbfd..1a7e1ae 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 edbd319..d3ed5c9 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 2618631..d512c93 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 a5ece7f..203fcb2 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 de3f661..247613c 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 0be005d..fbdf900 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 83f45ee..a29e39d 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 c5aedb6..bbea2e4 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 62b7ee7..26f6d37 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