Revert the patch for bug 527214 and related changes. GTimer
authorMatthias Clasen <matthiasc@src.gnome.org>
Tue, 27 May 2008 16:00:51 +0000 (16:00 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 27 May 2008 16:00:51 +0000 (16:00 +0000)
        is supposed to work without threads.

svn path=/trunk/; revision=6943

14 files changed:
ChangeLog
docs/reference/glib/tmpl/threads.sgml
docs/reference/glib/tmpl/timers.sgml
gio/tests/Makefile.am
gio/tests/data-input-stream.c
gio/tests/data-output-stream.c
gio/tests/g-file-info.c
gio/tests/g-file.c
gio/tests/live-g-file.c
gio/tests/memory-input-stream.c
glib/Makefile.am
glib/gtimer.c
glib/pcre/Makefile.am
glib/tests/Makefile.am

index 636ef0413f8f444348423fab9845bef862c85ed1..8eab6f640fab028d87838626726207aab3bbd9ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-27  Matthias Clasen  <mclasen@redhat.com>
+
+       * Revert the patch for bug 527214 and related changes. GTimer
+       is supposed to work without threads.
+
 2008-05-27  simon.zheng  <simon.zheng@sun.com>
 
        * configure.in: Fix #533369. Check whether memeber statvfs.f_basetype 
index f0c59d0fedb10feb55cec573d61efdd5bee852c8..3cbbbfcc7b32f50b27f8ac15239bbdb4f531e3e9 100644 (file)
@@ -162,20 +162,22 @@ the thread system by calling g_thread_init(). Most of the time you
 will only have to call <literal>g_thread_init (NULL)</literal>. 
 </para>
 
-<note>
-<para>
+<note><para>
 Do not call g_thread_init() with a non-%NULL parameter unless you
 really know what you are doing.
-</para>
-</note>
+</para></note>
 
-<note>
-<para>
+<note><para>
 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().
-</para>
-</note>
+</para></note>
+
+<note><para>
+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.
+</para></note>
 
 <para>
 g_thread_init() might only be called once. On the second call
index 52290955f77900a5861d1416a966c7c5d5571b3c..8e3cfa80611e49d55f6884189cbdf880e5867381 100644 (file)
@@ -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.
 </para>
 <note><para>
-#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.
 </para></note>
 
 <!-- ##### SECTION See_Also ##### -->
@@ -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).
 </para>
-<note><para>
-Call g_thread_init() before using this function.
-</para></note>
 
 @Returns: a new #GTimer.
 
index 8f2bb83f61b1ed2a1973370bbe310145233b0b81..6f3c65025f263b1e238185aae75a9002f4ab2b3a 100644 (file)
@@ -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
 
index b979066ac0ffbad0500a575b5b1f2b8cb0bfb321..6abc7c471eb57b13c40a1ba443f5a3ae06904e04 100644 (file)
@@ -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);
index 56edbfdd7de72d5442bdcc8e1a644d0dbe3c408a..1a7e1ae84c234d5dc38f75517b6398cd8d4f01e9 100644 (file)
@@ -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);
index edbd319341224ea2d529b4b545c1e4cd2d699ae6..d3ed5c98ecd189492932f5f7e43fa587dbe585c4 100644 (file)
@@ -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);
index 26186313eb25e6c2e66eddab9c48c163b64839e2..d512c9306f188d550288343ea033744b28f2b691 100644 (file)
@@ -507,7 +507,6 @@ main (int   argc,
       char *argv[])
 {
   g_type_init ();
-  g_thread_init (0);
   g_test_init (&argc, &argv, NULL);
   
   
index a5ece7f8aae9716161c36b213191bc007227caf4..203fcb27d8d6f1d4955ec31b5421f4a750c3eebc 100644 (file)
@@ -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  */ 
index de3f661c5f209efe52342f73076b6462830baba3..247613c6d5a026f52d6986b85a4530544277c026 100644 (file)
@@ -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);
index 0be005da34c893bb2638e4bda06f73eb0caecf68..fbdf900b913a85e60ffaa6b5ed16cef5d1dc7ec7 100644 (file)
@@ -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}
index 83f45ee3b1f5dd59545745a1cec9562a1df51ea0..a29e39dd25445a9c1988321fb107e522f3164fd3 100644 (file)
@@ -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;
 
index c5aedb673a936282bb9bb8dce6100bf5b0581710..bbea2e498c9e2f8efd7cd265ce55dc9613770742 100644 (file)
@@ -62,3 +62,5 @@ EXTRA_DIST =                          \
                COPYING                 \
                makefile.msc
 
+# automake workaround
+test:
index 62b7ee72a79377a4e0f4b1be9fc75a062bd9617b..26f6d37acfc534adf785496778be8a57a0c559e7 100644 (file)
@@ -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