From: Matthias Clasen Date: Fri, 20 May 2005 17:15:37 +0000 (+0000) Subject: Add a paragraph about thread safety of GLib data structures. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=6b361806794398721a3c317c2a49997c36f8e6df;p=dana%2Fcg-glib.git Add a paragraph about thread safety of GLib data structures. 2005-05-20 Matthias Clasen * glib/tmpl/threads.sgml: Add a paragraph about thread safety of GLib data structures. --- diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 3e210500..0c9df5f7 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,5 +1,8 @@ 2005-05-20 Matthias Clasen + * glib/tmpl/threads.sgml: Add a paragraph about thread + safety of GLib data structures. + * glib/compiling.sgml: Update an example from 1.3 to 2.x 2005-05-13 Matthias Clasen diff --git a/docs/reference/glib/tmpl/threads.sgml b/docs/reference/glib/tmpl/threads.sgml index e84bb98c..80f50cc9 100644 --- a/docs/reference/glib/tmpl/threads.sgml +++ b/docs/reference/glib/tmpl/threads.sgml @@ -32,6 +32,14 @@ for thread-private data, that every thread has a private instance of primitives to portably create and manage threads (#GThread). + +You must call g_thread_init() before executing any other GLib functions +in a threaded GLib program. After that, GLib is completely thread safe +(all global data is automatically locked). But individual data structure +instances are not automatically locked for performance reasons. So e.g. +you must coordinate accesses to the same #GHashTable from multiple threads. + +