glib r6907 - in trunk: . docs/reference docs/reference/glib/tmpl glib
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6907 - in trunk: . docs/reference docs/reference/glib/tmpl glib
- Date: Sun, 18 May 2008 19:15:33 +0000 (UTC)
Author: matthiasc
Date: Sun May 18 19:15:32 2008
New Revision: 6907
URL: http://svn.gnome.org/viewvc/glib?rev=6907&view=rev
Log:
Bug 527214 â g_timer_elapsed() returns random values.
* glib/gtimer.c (g_timer_new()):
Print warning if g_thread_init() has not been called yet.
Patch by Mathias Hasselmann
Modified:
trunk/ChangeLog
trunk/docs/reference/ChangeLog
trunk/docs/reference/glib/tmpl/timers.sgml
trunk/glib/gtimer.c
Modified: trunk/docs/reference/glib/tmpl/timers.sgml
==============================================================================
--- trunk/docs/reference/glib/tmpl/timers.sgml (original)
+++ trunk/docs/reference/glib/tmpl/timers.sgml Sun May 18 19:15:32 2008
@@ -10,6 +10,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.
+</para></note>
<!-- ##### SECTION See_Also ##### -->
<para>
@@ -30,6 +34,9 @@
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.
Modified: trunk/glib/gtimer.c
==============================================================================
--- trunk/glib/gtimer.c (original)
+++ trunk/glib/gtimer.c Sun May 18 19:15:32 2008
@@ -69,6 +69,10 @@
{
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]