From 6b361806794398721a3c317c2a49997c36f8e6df Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 20 May 2005 17:15:37 +0000 Subject: [PATCH] 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. --- docs/reference/ChangeLog | 3 +++ docs/reference/glib/tmpl/threads.sgml | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 3e2105004..0c9df5f73 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 e84bb98c5..80f50cc95 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. + + -- 2.34.1