adapt to work with new CVS gtk-doc, leaving the old rules in place caused

Wed Jan 31 07:14:22 2001  Tim Janik  <timj@gtk.org>

        * gobject/Makefile.am: adapt to work with new CVS gtk-doc, leaving the old
        rules in place caused bogus recursions. main changes:
        - add to conditionalized section:
          all-local:
                $(MAKE) scan
                $(MAKE) templates
                $(MAKE) sgml
                $(MAKE) html.stamp
          html.stamp: sgml.stamp $(EXTRA_SGML_FILES)
                $(MAKE) html
          DOC_STAMPS= html.stamp sgml.stamp
        - change:
          maintainer-clean-local: clean
          -     cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
          +     cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt $(DOC_STAMPS)

        * glib/Makefile.am (maintainer-clean-local): dito.

Wed Jan 31 06:21:32 2001  Tim Janik  <timj@gtk.org>

        * gobject/tmpl/types.sgml: applied docu patch from Eric Lemings
        <eric.b.lemings@lmco.com>, did some more editing.

Wed Jan 31 06:19:49 2001  Tim Janik  <timj@gtk.org>

        * gparam.h: gtk-doc sucks for not dealing with #define inside enums.

        * gtype.[hc]: added G_TYPE_FLAG_RESERVED_ID_BIT, a bit in the type
        number that's supposed to be left untouched (preserved mainly
        for the signal code).

        * *.c: added thread safety code, based on an old patch from sebastian.
        the remaining thread safety issues are now datalists on pspecs (to be
        solved im gdataset.c) and gvalue.c where locking concerns value exchange
        functionality only, and that's soon to be revised.
This commit is contained in:
Tim Janik 2001-01-31 06:27:41 +00:00 committed by Tim Janik
parent f9dfcb27b7
commit f0b9abe801
20 changed files with 1291 additions and 737 deletions

View File

@ -1,7 +1,32 @@
Wed Jan 31 07:14:22 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: adapt to work with new CVS gtk-doc, leaving the old
rules in place caused bogus recursions. main changes:
- add to conditionalized section:
all-local:
$(MAKE) scan
$(MAKE) templates
$(MAKE) sgml
$(MAKE) html.stamp
html.stamp: sgml.stamp $(EXTRA_SGML_FILES)
$(MAKE) html
DOC_STAMPS= html.stamp sgml.stamp
- change:
maintainer-clean-local: clean
- cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+ cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt $(DOC_STAMPS)
* glib/Makefile.am (maintainer-clean-local): dito.
Wed Jan 31 06:21:32 2001 Tim Janik <timj@gtk.org>
* gobject/tmpl/types.sgml: applied docu patch from Eric Lemings
<eric.b.lemings@lmco.com>, did some more editing.
2001-01-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de> 2001-01-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib/glib-sections.txt, glib/tmpl/threads.sgml: Added * glib/glib-sections.txt, glib/tmpl/threads.sgml: Added
g_static_mutex_free g_static_mutex_free().
Tue Jan 9 03:10:38 2001 Tim Janik <timj@gtk.org> Tue Jan 9 03:10:38 2001 Tim Janik <timj@gtk.org>

View File

@ -96,19 +96,28 @@ EXTRA_DIST = \
$(DOC_MODULE)-overrides.txt $(DOC_MODULE)-overrides.txt
if ENABLE_GTK_DOC if ENABLE_GTK_DOC
all-local: html/index.html all-local:
$(DOC_MODULE)-decl.txt:
$(MAKE) scan $(MAKE) scan
$(tmpl_sources): $(DOC_MODULE)-decl.txt $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
$(MAKE) templates $(MAKE) templates
sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) $(DOC_MODULE)-decl.txt
$(MAKE) sgml $(MAKE) sgml
$(MAKE) html.stamp
html/index.html: sgml/$(DOC_MODULE)-doc.bottom $(DOC_MAIN_SGML_FILE) html.stamp: sgml.stamp $(EXTRA_SGML_FILES)
$(MAKE) html $(MAKE) html
DOC_STAMPS= html.stamp sgml.stamp
#all-local: html/index.html
#
#$(DOC_MODULE)-decl.txt:
# $(MAKE) scan
#
#$(tmpl_sources): $(DOC_MODULE)-decl.txt $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
# $(MAKE) templates
#
#sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) $(DOC_MODULE)-decl.txt
# $(MAKE) sgml
#
#html/index.html: sgml/$(DOC_MODULE)-doc.bottom $(DOC_MAIN_SGML_FILE)
# $(MAKE) html
endif endif
scan: scan:
@ -133,7 +142,7 @@ clean-local:
rm -f *~ *.bak *.signals *-unused.txt rm -f *~ *.bak *.signals *-unused.txt
maintainer-clean-local: clean maintainer-clean-local: clean
cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt $(DOC_STAMPS)
install-data-local: install-data-local:
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)

View File

@ -45,19 +45,28 @@ EXTRA_DIST = \
$(DOC_MODULE)-overrides.txt $(DOC_MODULE)-overrides.txt
if ENABLE_GTK_DOC if ENABLE_GTK_DOC
all-local: html/index.html all-local:
$(DOC_MODULE)-decl.txt:
$(MAKE) scan $(MAKE) scan
$(tmpl_sources): $(DOC_MODULE)-decl.txt $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
$(MAKE) templates $(MAKE) templates
sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) $(DOC_MODULE)-decl.txt
$(MAKE) sgml $(MAKE) sgml
$(MAKE) html.stamp
html/index.html: sgml/$(DOC_MODULE)-doc.bottom $(DOC_MAIN_SGML_FILE) html.stamp: sgml.stamp $(EXTRA_SGML_FILES)
$(MAKE) html $(MAKE) html
DOC_STAMPS= html.stamp sgml.stamp
#all-local: html/index.html
#
#$(DOC_MODULE)-decl.txt:
# $(MAKE) scan
#
#$(tmpl_sources): $(DOC_MODULE)-decl.txt $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
# $(MAKE) templates
#
#sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) $(DOC_MODULE)-decl.txt
# $(MAKE) sgml
#
#html/index.html: sgml/$(DOC_MODULE)-doc.bottom $(DOC_MAIN_SGML_FILE)
# $(MAKE) html
endif endif
scan: scan:
@ -81,7 +90,7 @@ clean-local:
rm -f *~ *.bak *.signals *-unused.txt rm -f *~ *.bak *.signals *-unused.txt
maintainer-clean-local: clean maintainer-clean-local: clean
cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt $(DOC_STAMPS)
install-data-local: install-data-local:
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)

View File

@ -39,6 +39,7 @@ G_TYPE_CHECK_CLASS_CAST
G_TYPE_CHECK_CLASS_TYPE G_TYPE_CHECK_CLASS_TYPE
G_TYPE_CHECK_VALUE G_TYPE_CHECK_VALUE
G_TYPE_CHECK_VALUE_TYPE G_TYPE_CHECK_VALUE_TYPE
G_TYPE_FLAG_RESERVED_ID_BIT
g_type_init g_type_init
g_type_name g_type_name
g_type_qname g_type_qname
@ -300,6 +301,7 @@ g_value_dup_param
g_value_get_ccallback g_value_get_ccallback
g_value_get_pointer g_value_get_pointer
g_value_set_pointer g_value_set_pointer
g_value_get_as_pointer
g_value_set_ccallback g_value_set_ccallback
g_value_set_instance g_value_set_instance
</SECTION> </SECTION>
@ -316,6 +318,9 @@ G_IS_PARAM_SPEC
G_PARAM_SPEC_GET_CLASS G_PARAM_SPEC_GET_CLASS
G_PARAM_SPEC_VALUE_TYPE G_PARAM_SPEC_VALUE_TYPE
G_TYPE_IS_PARAM G_TYPE_IS_PARAM
G_PARAM_READWRITE
G_PARAM_MASK
G_PARAM_USER_SHIFT
GParamFlags GParamFlags
g_param_spec_ref g_param_spec_ref
g_param_spec_unref g_param_spec_unref
@ -328,12 +333,14 @@ g_param_value_set_default
g_param_value_defaults g_param_value_defaults
g_param_value_validate g_param_value_validate
g_param_values_cmp g_param_values_cmp
g_param_spec_internal GParamSpecTypeInfo
g_param_type_register_static
GParamSpecPool
g_param_spec_pool_new g_param_spec_pool_new
g_param_spec_pool_insert g_param_spec_pool_insert
g_param_spec_pool_remove g_param_spec_pool_remove
g_param_spec_pool_lookup g_param_spec_pool_lookup
g_param_type_register_static g_param_spec_internal
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -462,18 +469,20 @@ g_signal_type_cclosure_new
<SECTION> <SECTION>
<TITLE>Closures</TITLE> <TITLE>Closures</TITLE>
<FILE>closures</FILE> <FILE>closures</FILE>
GClosureMarshal
GClosureNotify
GClosure
GCClosure
GClosureNotifyData
GCallback
G_CLOSURE_NEEDS_MARSHAL G_CLOSURE_NEEDS_MARSHAL
G_CCLOSURE_SWAP_DATA G_CCLOSURE_SWAP_DATA
G_CALLBACK
GCallback
GClosure
GCClosure
GClosureMarshal
GClosureNotify
GClosureNotifyData
g_cclosure_new g_cclosure_new
g_cclosure_new_swap g_cclosure_new_swap
g_cclosure_new_object g_cclosure_new_object
g_cclosure_new_object_swap g_cclosure_new_object_swap
g_closure_new_object
g_closure_ref g_closure_ref
g_closure_unref g_closure_unref
g_closure_invoke g_closure_invoke

View File

@ -14,6 +14,51 @@ Closures
</para> </para>
<!-- ##### MACRO G_CLOSURE_NEEDS_MARSHAL ##### -->
<para>
</para>
@closure:
<!-- ##### MACRO G_CCLOSURE_SWAP_DATA ##### -->
<para>
</para>
@cclosure:
<!-- ##### MACRO G_CALLBACK ##### -->
<para>
</para>
@f:
<!-- ##### TYPEDEF GCallback ##### -->
<para>
</para>
<!-- ##### STRUCT GClosure ##### -->
<para>
</para>
@is_invalid:
<!-- ##### STRUCT GCClosure ##### -->
<para>
</para>
@closure:
@callback:
<!-- ##### USER_FUNCTION GClosureMarshal ##### --> <!-- ##### USER_FUNCTION GClosureMarshal ##### -->
<para> <para>
@ -36,21 +81,6 @@ Closures
@closure: @closure:
<!-- ##### STRUCT GClosure ##### -->
<para>
</para>
@is_invalid:
<!-- ##### STRUCT GCClosure ##### -->
<para>
</para>
@closure:
@callback:
<!-- ##### STRUCT GClosureNotifyData ##### --> <!-- ##### STRUCT GClosureNotifyData ##### -->
<para> <para>
@ -59,28 +89,6 @@ Closures
@data: @data:
@notify: @notify:
<!-- ##### TYPEDEF GCallback ##### -->
<para>
</para>
<!-- ##### MACRO G_CLOSURE_NEEDS_MARSHAL ##### -->
<para>
</para>
@closure:
<!-- ##### MACRO G_CCLOSURE_SWAP_DATA ##### -->
<para>
</para>
@cclosure:
<!-- ##### FUNCTION g_cclosure_new ##### --> <!-- ##### FUNCTION g_cclosure_new ##### -->
<para> <para>
@ -123,6 +131,16 @@ Closures
@Returns: @Returns:
<!-- ##### FUNCTION g_closure_new_object ##### -->
<para>
</para>
@sizeof_closure:
@object:
@Returns:
<!-- ##### FUNCTION g_closure_ref ##### --> <!-- ##### FUNCTION g_closure_ref ##### -->
<para> <para>

View File

@ -88,6 +88,27 @@ Parameter Specifications
@type: @type:
<!-- ##### MACRO G_PARAM_READWRITE ##### -->
<para>
</para>
<!-- ##### MACRO G_PARAM_MASK ##### -->
<para>
</para>
<!-- ##### MACRO G_PARAM_USER_SHIFT ##### -->
<para>
</para>
<!-- ##### ENUM GParamFlags ##### --> <!-- ##### ENUM GParamFlags ##### -->
<para> <para>
@ -205,19 +226,36 @@ Parameter Specifications
@Returns: @Returns:
<!-- ##### FUNCTION g_param_spec_internal ##### --> <!-- ##### STRUCT GParamSpecTypeInfo ##### -->
<para>
</para>
@instance_size:
@n_preallocs:
@instance_init:
@value_type:
@finalize:
@value_set_default:
@value_validate:
@values_cmp:
<!-- ##### FUNCTION g_param_type_register_static ##### -->
<para> <para>
</para> </para>
@param_type:
@name: @name:
@nick: @pspec_info:
@blurb:
@flags:
@Returns: @Returns:
<!-- ##### STRUCT GParamSpecPool ##### -->
<para>
</para>
<!-- ##### FUNCTION g_param_spec_pool_new ##### --> <!-- ##### FUNCTION g_param_spec_pool_new ##### -->
<para> <para>
@ -259,13 +297,16 @@ Parameter Specifications
@Returns: @Returns:
<!-- ##### FUNCTION g_param_type_register_static ##### --> <!-- ##### FUNCTION g_param_spec_internal ##### -->
<para> <para>
</para> </para>
@param_type:
@name: @name:
@pspec_info: @nick:
@blurb:
@flags:
@Returns: @Returns:

View File

@ -2,11 +2,26 @@
GType GType
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
The GLib Runtime type identification and management system
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
The GType API is the foundation of the GObject system. It provides the
facilities for registering and managing all fundamental data types,
user-defined object and interface types. Before using any GType
or GObject functions, g_type_init() must be called to initialize the
type system.
</para>
<para>
For type creation and registration purposes, all types fall into one of
two categories: static or dynamic. Static types are never loaded or
unloaded at run-time as dynamic types may be. Static types are created
with g_type_register_static() that gets type specific information passed
in via a #GTypeInfo structure.
Dynamic types are created with g_type_register_dynamic() which takes a
#GTypePlugin structure instead. The remaining type information (the
#GTypeInfo structure) is retrived during runtime through #GTypePlugin
and the g_type_plugin_*() API.
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
@ -16,21 +31,25 @@ GType
<!-- ##### TYPEDEF GType ##### --> <!-- ##### TYPEDEF GType ##### -->
<para> <para>
A numerical value which represents the unique identifier of a registered
type.
</para> </para>
<!-- ##### MACRO G_TYPE_FUNDAMENTAL ##### --> <!-- ##### MACRO G_TYPE_FUNDAMENTAL ##### -->
<para> <para>
Returns #TRUE if @type is a fundamental data type such as #G_TYPE_INT or
#G_TYPE_POINTER. Fundamental types are types that serve as fundaments for
the derived types, thus they are the roots of distinct inheritance heirachies.
</para> </para>
@type: @type: a #GType value
<!-- ##### MACRO G_TYPE_FUNDAMENTAL_MAX ##### --> <!-- ##### MACRO G_TYPE_FUNDAMENTAL_MAX ##### -->
<para> <para>
An integer constant that represents the number of identifiers reserved
for types that are assigned at compile-time.
</para> </para>
@ -54,25 +73,32 @@ GType
<!-- ##### MACRO G_TYPE_FUNDAMENTAL_LAST ##### --> <!-- ##### MACRO G_TYPE_FUNDAMENTAL_LAST ##### -->
<para> <para>
An integer that currently represents the highest value of all
fundamental type identifiers. This is of interest for dynamic
introduction of new fundamental types (a
<emphasis>rarely</emphasis> needed feature).
</para> </para>
<!-- ##### MACRO G_TYPE_IS_ABSTRACT ##### --> <!-- ##### MACRO G_TYPE_IS_ABSTRACT ##### -->
<para> <para>
Returns #TRUE if @type is an abstract type. An abstract type can not be
instantiated and is normally used as an abstract base class for
derived classes.
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_DERIVED ##### --> <!-- ##### MACRO G_TYPE_IS_DERIVED ##### -->
<para> <para>
Returns #TRUE if @type is derived (or in object-oriented terminolgy:
inherited) from another type (this holds true for all non-fundamental
types).
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_FUNDAMENTAL ##### --> <!-- ##### MACRO G_TYPE_IS_FUNDAMENTAL ##### -->
@ -80,7 +106,7 @@ GType
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_VALUE_TYPE ##### --> <!-- ##### MACRO G_TYPE_IS_VALUE_TYPE ##### -->
@ -88,7 +114,7 @@ GType
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_CLASSED ##### --> <!-- ##### MACRO G_TYPE_IS_CLASSED ##### -->
@ -96,15 +122,16 @@ GType
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_INSTANTIATABLE ##### --> <!-- ##### MACRO G_TYPE_IS_INSTANTIATABLE ##### -->
<para> <para>
Returns #TRUE if @type can be instantiated. Instantiation is the
process of creating an instance (object) of this type.
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_DERIVABLE ##### --> <!-- ##### MACRO G_TYPE_IS_DERIVABLE ##### -->
@ -112,7 +139,7 @@ GType
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_DEEP_DERIVABLE ##### --> <!-- ##### MACRO G_TYPE_IS_DEEP_DERIVABLE ##### -->
@ -120,15 +147,18 @@ GType
</para> </para>
@type: @type: A #GType value.
<!-- ##### MACRO G_TYPE_IS_INTERFACE ##### --> <!-- ##### MACRO G_TYPE_IS_INTERFACE ##### -->
<para> <para>
Returns #TRUE if @type is an interface type.
Interface types are types that provide pure APIs, the implementation
of which is provided by another type (which is then said to conform
to the interface).
</para> </para>
@type: @type: A #GType value.
<!-- ##### ENUM GTypeFundamentals ##### --> <!-- ##### ENUM GTypeFundamentals ##### -->
@ -195,19 +225,27 @@ GType
<!-- ##### STRUCT GTypeInfo ##### --> <!-- ##### STRUCT GTypeInfo ##### -->
<para> <para>
This structure is used to provide the type system with the information
required to initialize and destruct (finalize) a type's class and
instances thereof.
The initialized structure is passed to the g_type_register_static() function
(or is copied into the provided #GTypeInfo structure in the
g_type_plugin_complete_type_info()). The type system will perform a deep
copy of this structure, so it's memory does not need to be persistent
across invocation of g_type_register_static().
</para> </para>
@class_size: @class_size: Size of the class structure (required for interface, classed and instantiatable types).
@base_init: @base_init: Location of the base initialization function (optional).
@base_finalize: @base_finalize: Location of the base finalization function (optional).
@class_init: @class_init: Location of the class initialization function (optional, for classed and instantiatable types only).
@class_finalize: @class_finalize: Location of the class finalization function (optional).
@class_data: @class_data: User-supplied data passed to the class init/finalize functions.
@instance_size: @instance_size: Size of the instance (object) structure (required for instantiatable types only).
@n_preallocs: @n_preallocs: Number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching).
@instance_init: @instance_init: The location of the instance initialization function (optional, for instantiatable types only).
@value_table: @value_table: Function table for generic handling of GValues of this type (usualy only usefull for
fundamental types).
<!-- ##### STRUCT GTypeFundamentalInfo ##### --> <!-- ##### STRUCT GTypeFundamentalInfo ##### -->
<para> <para>
@ -346,6 +384,13 @@ GType
@g_type: @g_type:
<!-- ##### MACRO G_TYPE_FLAG_RESERVED_ID_BIT ##### -->
<para>
</para>
<!-- ##### FUNCTION g_type_init ##### --> <!-- ##### FUNCTION g_type_init ##### -->
<para> <para>
Prior to any use of the type system, g_type_init() has to be called to initialize Prior to any use of the type system, g_type_init() has to be called to initialize

View File

@ -371,6 +371,15 @@ Standard value types
@v_pointer: @v_pointer:
<!-- ##### FUNCTION g_value_get_as_pointer ##### -->
<para>
</para>
@value:
@Returns:
<!-- ##### FUNCTION g_value_set_ccallback ##### --> <!-- ##### FUNCTION g_value_set_ccallback ##### -->
<para> <para>

View File

@ -1,3 +1,16 @@
Wed Jan 31 06:19:49 2001 Tim Janik <timj@gtk.org>
* gparam.h: gtk-doc sucks for not dealing with #define inside enums.
* gtype.[hc]: added G_TYPE_FLAG_RESERVED_ID_BIT, a bit in the type
number that's supposed to be left untouched (preserved mainly
for the signal code).
* *.c: added thread safety code, based on an old patch from sebastian.
the remaining thread safety issues are now datalists on pspecs (to be
solved im gdataset.c) and gvalue.c where locking concerns value exchange
functionality only, and that's soon to be revised.
2001-01-27 Tor Lillqvist <tml@iki.fi> 2001-01-27 Tor Lillqvist <tml@iki.fi>
* makefile.msc.in: Don't try to compile gmarshal.c on its own. * makefile.msc.in: Don't try to compile gmarshal.c on its own.

View File

@ -16,6 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "gclosure.h" #include "gclosure.h"
#include "gvalue.h" #include "gvalue.h"

View File

@ -17,6 +17,10 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* MT safe
*/
#include <string.h> #include <string.h>
#include "genums.h" #include "genums.h"

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* MT safe
*/
#include "gobject.h" #include "gobject.h"
@ -140,9 +145,10 @@ static gulong gobject_signals[LAST_SIGNAL] = { 0, };
gboolean glib_debug_objects = FALSE; gboolean glib_debug_objects = FALSE;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
G_LOCK_DEFINE_STATIC (debug_objects);
static volatile GObject *glib_trap_object_ref = NULL; static volatile GObject *glib_trap_object_ref = NULL;
static guint debug_objects_count = 0; static guint debug_objects_count = 0;
static GHashTable *debug_objects_ht = NULL; static GHashTable *debug_objects_ht = NULL;
static void static void
debug_objects_foreach (gpointer key, debug_objects_foreach (gpointer key,
gpointer value, gpointer value,
@ -158,6 +164,7 @@ debug_objects_foreach (gpointer key,
static void static void
debug_objects_atexit (void) debug_objects_atexit (void)
{ {
G_LOCK (debug_objects);
if (glib_debug_objects) if (glib_debug_objects)
{ {
if (debug_objects_ht) if (debug_objects_ht)
@ -166,6 +173,7 @@ debug_objects_atexit (void)
g_hash_table_foreach (debug_objects_ht, debug_objects_foreach, NULL); g_hash_table_foreach (debug_objects_ht, debug_objects_foreach, NULL);
} }
} }
G_UNLOCK (debug_objects);
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
@ -433,6 +441,7 @@ g_object_init (GObject *object)
object_freeze_notifies (object); object_freeze_notifies (object);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
G_LOCK (debug_objects);
if (glib_debug_objects) if (glib_debug_objects)
{ {
if (!debug_objects_ht) if (!debug_objects_ht)
@ -440,6 +449,7 @@ g_object_init (GObject *object)
debug_objects_count++; debug_objects_count++;
g_hash_table_insert (debug_objects_ht, object, object); g_hash_table_insert (debug_objects_ht, object, object);
} }
G_UNLOCK (debug_objects);
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
} }
@ -522,8 +532,10 @@ g_object_last_unref (GObject *object)
{ {
G_OBJECT_GET_CLASS (object)->finalize (object); G_OBJECT_GET_CLASS (object)->finalize (object);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
G_LOCK (debug_objects);
if (glib_debug_objects && debug_objects_ht) if (glib_debug_objects && debug_objects_ht)
g_assert (g_hash_table_lookup (debug_objects_ht, object) == NULL); g_assert (g_hash_table_lookup (debug_objects_ht, object) == NULL);
G_UNLOCK (debug_objects);
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
g_type_free_instance ((GTypeInstance*) object); g_type_free_instance ((GTypeInstance*) object);
} }
@ -545,6 +557,7 @@ g_object_finalize (GObject *object)
g_datalist_clear (&object->qdata); g_datalist_clear (&object->qdata);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
G_LOCK (debug_objects);
if (glib_debug_objects) if (glib_debug_objects)
{ {
g_assert (g_hash_table_lookup (debug_objects_ht, object) == object); g_assert (g_hash_table_lookup (debug_objects_ht, object) == object);
@ -552,6 +565,7 @@ g_object_finalize (GObject *object)
g_hash_table_remove (debug_objects_ht, object); g_hash_table_remove (debug_objects_ht, object);
debug_objects_count--; debug_objects_count--;
} }
G_UNLOCK (debug_objects);
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
} }

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* MT safe
*/
#include "gparam.h" #include "gparam.h"
@ -25,8 +30,11 @@
/* --- defines --- */ /* --- defines --- */
#define G_PARAM_SPEC_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_PARAM, GParamSpecClass)) #define G_PARAM_SPEC_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_PARAM, GParamSpecClass))
#define PSPEC_APPLIES_TO_VALUE(pspec, value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_PARAM_SPEC_VALUE_TYPE (pspec))) #define G_PARAM_USER_MASK ((1 << G_PARAM_USER_SHIFT) - 1)
#define PSPEC_APPLIES_TO_VALUE(pspec, value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
#define G_SLOCK(mutex) g_static_mutex_lock (mutex)
#define G_SUNLOCK(mutex) g_static_mutex_unlock (mutex)
/* --- prototypes --- */ /* --- prototypes --- */
@ -54,6 +62,7 @@ static gchar* value_param_lcopy_value (const GValue *value,
/* --- variables --- */ /* --- variables --- */
static GQuark quark_floating = 0; static GQuark quark_floating = 0;
G_LOCK_DEFINE_STATIC (pspec_ref_count);
/* --- functions --- */ /* --- functions --- */
@ -151,10 +160,19 @@ GParamSpec*
g_param_spec_ref (GParamSpec *pspec) g_param_spec_ref (GParamSpec *pspec)
{ {
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL); g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
g_return_val_if_fail (pspec->ref_count > 0, NULL);
pspec->ref_count += 1;
G_LOCK (pspec_ref_count);
if (pspec->ref_count > 0)
{
pspec->ref_count += 1;
G_UNLOCK (pspec_ref_count);
}
else
{
G_UNLOCK (pspec_ref_count);
g_return_val_if_fail (pspec->ref_count > 0, NULL);
}
return pspec; return pspec;
} }
@ -162,27 +180,53 @@ void
g_param_spec_unref (GParamSpec *pspec) g_param_spec_unref (GParamSpec *pspec)
{ {
g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (pspec->ref_count > 0);
/* sync with _sink */ G_LOCK (pspec_ref_count);
pspec->ref_count -= 1; if (pspec->ref_count > 0)
if (pspec->ref_count == 0) {
G_PARAM_SPEC_GET_CLASS (pspec)->finalize (pspec); gboolean need_finalize;
/* sync with _sink */
pspec->ref_count -= 1;
need_finalize = pspec->ref_count == 0;
G_UNLOCK (pspec_ref_count);
if (need_finalize)
G_PARAM_SPEC_GET_CLASS (pspec)->finalize (pspec);
}
else
{
G_UNLOCK (pspec_ref_count);
g_return_if_fail (pspec->ref_count > 0);
}
} }
void void
g_param_spec_sink (GParamSpec *pspec) g_param_spec_sink (GParamSpec *pspec)
{ {
g_return_if_fail (G_IS_PARAM_SPEC (pspec)); g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (pspec->ref_count > 0);
if (g_datalist_id_remove_no_notify (&pspec->qdata, quark_floating)) G_LOCK (pspec_ref_count);
if (pspec->ref_count > 0)
{ {
/* sync with _unref */ if (g_datalist_id_remove_no_notify (&pspec->qdata, quark_floating))
if (pspec->ref_count > 1) {
pspec->ref_count -= 1; /* sync with _unref */
else if (pspec->ref_count > 1)
g_param_spec_unref (pspec); pspec->ref_count -= 1;
else
{
G_UNLOCK (pspec_ref_count);
g_param_spec_unref (pspec);
return;
}
}
G_UNLOCK (pspec_ref_count);
}
else
{
G_UNLOCK (pspec_ref_count);
g_return_if_fail (pspec->ref_count > 0);
} }
} }
@ -405,8 +449,9 @@ value_param_lcopy_value (const GValue *value,
/* --- param spec pool --- */ /* --- param spec pool --- */
struct _GParamSpecPool struct _GParamSpecPool
{ {
gboolean type_prefixing; GStaticMutex smutex;
GHashTable *hash_table; gboolean type_prefixing;
GHashTable *hash_table;
}; };
static guint static guint
@ -436,8 +481,10 @@ param_spec_pool_equals (gconstpointer key_spec_1,
GParamSpecPool* GParamSpecPool*
g_param_spec_pool_new (gboolean type_prefixing) g_param_spec_pool_new (gboolean type_prefixing)
{ {
static GStaticMutex init_smutex = G_STATIC_MUTEX_INIT;
GParamSpecPool *pool = g_new (GParamSpecPool, 1); GParamSpecPool *pool = g_new (GParamSpecPool, 1);
memcpy (&pool->smutex, &init_smutex, sizeof (init_smutex));
pool->type_prefixing = type_prefixing != FALSE; pool->type_prefixing = type_prefixing != FALSE;
pool->hash_table = g_hash_table_new (param_spec_pool_hash, param_spec_pool_equals); pool->hash_table = g_hash_table_new (param_spec_pool_hash, param_spec_pool_equals);
@ -450,37 +497,52 @@ g_param_spec_pool_insert (GParamSpecPool *pool,
GType owner_type) GType owner_type)
{ {
gchar *p; gchar *p;
g_return_if_fail (pool != NULL); if (pool && pspec && owner_type > 0 && pspec->owner_type == 0)
g_return_if_fail (pspec);
g_return_if_fail (owner_type > 0);
g_return_if_fail (pspec->owner_type == 0);
for (p = pspec->name; *p; p++)
{ {
if (!strchr (G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-_", *p)) G_SLOCK (&pool->smutex);
for (p = pspec->name; *p; p++)
{ {
g_warning (G_STRLOC ": pspec name \"%s\" contains invalid characters", pspec->name); if (!strchr (G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-_", *p))
return; {
g_warning (G_STRLOC ": pspec name \"%s\" contains invalid characters", pspec->name);
G_SUNLOCK (&pool->smutex);
return;
}
} }
pspec->owner_type = owner_type;
g_param_spec_ref (pspec);
g_hash_table_insert (pool->hash_table, pspec, pspec);
G_SUNLOCK (&pool->smutex);
}
else
{
g_return_if_fail (pool != NULL);
g_return_if_fail (pspec);
g_return_if_fail (owner_type > 0);
g_return_if_fail (pspec->owner_type == 0);
} }
pspec->owner_type = owner_type;
g_param_spec_ref (pspec);
g_hash_table_insert (pool->hash_table, pspec, pspec);
} }
void void
g_param_spec_pool_remove (GParamSpecPool *pool, g_param_spec_pool_remove (GParamSpecPool *pool,
GParamSpec *pspec) GParamSpec *pspec)
{ {
g_return_if_fail (pool != NULL); if (pool && pspec)
g_return_if_fail (pspec); {
G_SLOCK (&pool->smutex);
if (g_hash_table_remove (pool->hash_table, pspec)) if (g_hash_table_remove (pool->hash_table, pspec))
g_param_spec_unref (pspec); g_param_spec_unref (pspec);
else
g_warning (G_STRLOC ": attempt to remove unknown pspec `%s' from pool", pspec->name);
G_SUNLOCK (&pool->smutex);
}
else else
g_warning (G_STRLOC ": attempt to remove unknown pspec `%s' from pool", pspec->name); {
g_return_if_fail (pool != NULL);
g_return_if_fail (pspec);
}
} }
static inline GParamSpec* static inline GParamSpec*
@ -542,8 +604,13 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
GParamSpec *pspec; GParamSpec *pspec;
gchar *delim; gchar *delim;
g_return_val_if_fail (pool != NULL, NULL); if (!pool || !param_name)
g_return_val_if_fail (param_name, NULL); {
g_return_val_if_fail (pool != NULL, NULL);
g_return_val_if_fail (param_name != NULL, NULL);
}
G_SLOCK (&pool->smutex);
delim = strchr (param_name, ':'); delim = strchr (param_name, ':');
@ -552,7 +619,10 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
{ {
if (trailer_p) if (trailer_p)
*trailer_p = NULL; *trailer_p = NULL;
return param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors); pspec = param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors);
G_SUNLOCK (&pool->smutex);
return pspec;
} }
/* strip type prefix */ /* strip type prefix */
@ -574,6 +644,8 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
{ {
if (trailer_p) if (trailer_p)
*trailer_p = NULL; *trailer_p = NULL;
G_SUNLOCK (&pool->smutex);
return NULL; return NULL;
} }
owner_type = type; owner_type = type;
@ -583,7 +655,10 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
{ {
if (trailer_p) if (trailer_p)
*trailer_p = NULL; *trailer_p = NULL;
return param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors); pspec = param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors);
G_SUNLOCK (&pool->smutex);
return pspec;
} }
} }
} }
@ -601,12 +676,16 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
g_free (buffer); g_free (buffer);
if (trailer_p) if (trailer_p)
*trailer_p = pspec ? delim + 2 : NULL; *trailer_p = pspec ? delim + 2 : NULL;
G_SUNLOCK (&pool->smutex);
return pspec; return pspec;
} }
/* malformed param_name */ /* malformed param_name */
if (trailer_p) if (trailer_p)
*trailer_p = NULL; *trailer_p = NULL;
G_SUNLOCK (&pool->smutex);
return NULL; return NULL;
} }

View File

@ -48,12 +48,12 @@ typedef enum
G_PARAM_WRITABLE = 1 << 1, G_PARAM_WRITABLE = 1 << 1,
G_PARAM_CONSTRUCT = 1 << 2, G_PARAM_CONSTRUCT = 1 << 2,
G_PARAM_CONSTRUCT_ONLY = 1 << 3, G_PARAM_CONSTRUCT_ONLY = 1 << 3,
G_PARAM_PRIVATE = 1 << 4, G_PARAM_PRIVATE = 1 << 4
#define G_PARAM_MASK (0x000000ff)
/* bits in the range 0xffffff00 are reserved for 3rd party usage */
#define G_PARAM_USER_MASK (0xffffff00)
} GParamFlags; } GParamFlags;
#define G_PARAM_READWRITE (G_PARAM_READABLE | G_PARAM_WRITABLE) #define G_PARAM_READWRITE (G_PARAM_READABLE | G_PARAM_WRITABLE)
#define G_PARAM_MASK (0x000000ff)
/* bits in the range 0xffffff00 are reserved for 3rd party usage */
#define G_PARAM_USER_SHIFT (8)
/* --- typedefs & structures --- */ /* --- typedefs & structures --- */

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* MT safe
*/
#include "gparamspecs.h" #include "gparamspecs.h"
#include "gvaluecollector.h" #include "gvaluecollector.h"

View File

@ -19,11 +19,15 @@
* this code is based on the original GtkSignal implementation * this code is based on the original GtkSignal implementation
* for the Gtk+ library by Peter Mattis <petm@xcf.berkeley.edu> * for the Gtk+ library by Peter Mattis <petm@xcf.berkeley.edu>
*/ */
#include <string.h>
/*
* MT safe
*/
#include "gsignal.h" #include "gsignal.h"
#include "gbsearcharray.h" #include "gbsearcharray.h"
#include "gvaluecollector.h" #include "gvaluecollector.h"
#include <string.h>
/* pre allocation configurations /* pre allocation configurations
@ -64,26 +68,10 @@ g_generic_node_alloc (GTrashStack **trash_stack_p,
return node; return node;
} }
static inline void #define g_generic_node_free(trash_stack_p, node) g_trash_stack_push (trash_stack_p, node)
g_generic_node_free (GTrashStack **trash_stack_p,
gpointer node)
{
g_trash_stack_push (trash_stack_p, node);
}
#else /* !DISABLE_MEM_POOLS */ #else /* !DISABLE_MEM_POOLS */
static inline gpointer #define g_generic_node_alloc(t,sizeof_node,p) g_malloc (sizeof_node)
g_generic_node_alloc (GTrashStack **trash_stack_p, #define g_generic_node_free(t,node) g_free (node)
guint sizeof_node,
guint nodes_pre_alloc)
{
return g_malloc (sizeof_node);
}
static inline void
g_generic_node_free (GTrashStack **trash_stack_p,
gpointer node)
{
g_free (node);
}
#endif /* !DISABLE_MEM_POOLS */ #endif /* !DISABLE_MEM_POOLS */
@ -2027,6 +2015,6 @@ signal_emit_R (SignalNode *node,
} }
/* compile standard marshallers */ /* --- compile standard marshallers --- */
#include "gvaluetypes.h" #include "gvaluetypes.h"
#include "gmarshal.c" #include "gmarshal.c"

File diff suppressed because it is too large Load Diff

View File

@ -344,6 +344,7 @@ GTypeValueTable* g_type_value_table_peek (GType type);
#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl)) #define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class)) #define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt)) #define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
#define G_TYPE_FLAG_RESERVED_ID_BIT (1 << 30)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -17,6 +17,10 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* FIXME: MT-safety
*/
#include <string.h> #include <string.h>
#include "gvalue.h" #include "gvalue.h"

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/*
* MT safe
*/
#include "gvaluetypes.h" #include "gvaluetypes.h"
#include "gvaluecollector.h" #include "gvaluecollector.h"