Make refcounting threadsafe by using atomic operations. (#166020, Wim
2005-07-15 Matthias Clasen <mclasen@redhat.com>
Make refcounting threadsafe by using atomic
operations. (#166020, Wim Taymans)
* gobject.c: Use a recursive lock to protect the
notify queue.
(g_object_unref): Get rid of g_object_last_unref and
do the last unref handling in g_object_unref.
(g_object_ref, g_object_unref): Use atomic operations.
* gsignal.c (struct _HandlerMatch): Use a full integer
for the ref_count field.
(handler_ref, handler_unref_R): Use atomic operations.
* gparam.c (g_param_spec_ref, g_param_spec_unref):
Use atomic operations instead of a lock to make the
refcounting threadsafe.
* gclosure.c (g_closure_ref, g_closure_unref): Use atomic
operations. This is more complicated here, since the
refcount is stored in a bitfield, so we also have
to access all other bitfield members atomically.
* gsignal.c (handlers_find): Read the meta_marshal flag
of the closure atomically.
* tests/Makefile.am (SUBDIRS): Add tests/refcount
* configure.in: Add tests/refcount
* tests/refcount/properties.c: Test property changes
from multiple threads.
* tests/refcount/signals.c: Test signal emission from
multiple threads.
* tests/refcount/objects.c: Test refcounting from
multiple threads.
* tests/refcount/objects2.c:
* tests/refcount/properties2.c: Tests to measure the
overhead of threadsafe refcounting.
* glib/giochannel.c (g_io_channel_ref, g_io_channel_unref):
Use atomic operations to make refcounting
threadsafe. (#166020, Wim Taymans)
2005-07-15 18:51:10 +02:00
|
|
|
SUBDIRS=gobject refcount
|
2003-09-25 21:01:57 +02:00
|
|
|
|
2003-03-04 11:10:48 +01:00
|
|
|
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I$(top_srcdir)/gmodule $(GLIB_DEBUG_FLAGS)
|
1999-01-03 04:42:59 +01:00
|
|
|
|
2000-10-09 18:24:57 +02:00
|
|
|
EFENCE=
|
|
|
|
|
2002-03-05 06:18:23 +01:00
|
|
|
libglib = $(top_builddir)/glib/libglib-2.0.la
|
|
|
|
libgthread = $(top_builddir)/gthread/libgthread-2.0.la
|
|
|
|
libgmodule = $(top_builddir)/gmodule/libgmodule-2.0.la
|
|
|
|
libgobject = $(top_builddir)/gobject/libgobject-2.0.la
|
2001-03-09 22:43:36 +01:00
|
|
|
|
2001-03-10 21:03:53 +01:00
|
|
|
if PLATFORM_WIN32
|
2001-03-12 07:09:05 +01:00
|
|
|
libadd_libgmodule = $(libgmodule)
|
2001-03-10 21:03:53 +01:00
|
|
|
libadd_libglib = $(libglib)
|
|
|
|
no_undefined = -no-undefined
|
2001-11-04 00:19:25 +01:00
|
|
|
|
|
|
|
module_test_exp = module-test.exp
|
|
|
|
|
|
|
|
module-test.exp: module-test.o
|
|
|
|
dlltool --output-exp module-test.exp module-test.o
|
Ignore the G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully
2002-11-17 Tor Lillqvist <tml@iki.fi>
* glib/gspawn-win32.c (g_spawn_async_with_pipes): Ignore the
G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully implemented
on Windows, at least not now. Always pass dont_wait as TRUE to
do_spawn_with_pipes(). The semantics of the dont_wait parameter is
very different from the semantics of the intermediate_child
parameter to fork_exec_with_pipes() in the Unix version. This
fixes a serious bug, g_spawn_async() in fact behaved
synchronously.
(do_spawn_with_pipes, do_spawn): Rename from
fork_exec_with_pipes() and do_exec(), those names were from the
Unix bersion, and misleading.
(close_and_invalidate): Don't try to close invalid fds.
* glib/gspawn.c (g_spawn_async_with_pipes): Add warning about
Windows behaviour. There is no fork(), so the child_setup()
function is in fact called in the parent.
* glib/gspawn-win32-helper.c (WinMain): Insert spaces in argv
debugging output.
* tests/spawn-test-win32-gui.c: New file. Test program to be
linked as a GUI application. Behaves differently depending on how
invoked (by spawn-test).
* tests/spawn-test.c (run_tests): On Win32, run the
spawn-test-win32-gui program, too, in several ways, synchronously
and asynchronously.
* tests/Makefile.am: Corresponding change.
2002-11-17 04:52:55 +01:00
|
|
|
|
|
|
|
spawn_test_win32_gui = spawn-test-win32-gui
|
|
|
|
|
|
|
|
spawn_test_win32_gui_LDFLAGS = -mwindows
|
|
|
|
|
2001-03-10 21:03:53 +01:00
|
|
|
endif
|
|
|
|
|
2001-08-12 16:12:02 +02:00
|
|
|
EXTRA_DIST = \
|
|
|
|
$(test_scripts) \
|
|
|
|
makefile.msc.in \
|
|
|
|
casefold.txt \
|
|
|
|
casemap.txt \
|
|
|
|
gen-casefold-txt.pl \
|
|
|
|
gen-casemap-txt.pl \
|
|
|
|
iochannel-test-infile \
|
2001-04-03 20:27:59 +02:00
|
|
|
utf8.txt
|
1999-07-24 20:50:58 +02:00
|
|
|
|
2001-08-12 16:12:02 +02:00
|
|
|
BUILT_EXTRA_DIST = \
|
2001-03-09 22:43:36 +01:00
|
|
|
makefile.msc
|
2000-10-16 03:02:19 +02:00
|
|
|
|
2001-05-29 16:17:23 +02:00
|
|
|
if HAVE_CXX
|
|
|
|
CXX_TEST = cxx-test
|
2001-12-22 09:29:06 +01:00
|
|
|
cxx_test_LDADD = $(progs_ldadd)
|
2001-05-29 16:17:23 +02:00
|
|
|
cxx_test_SOURCES = cxx-test.C
|
|
|
|
else
|
|
|
|
CXX_TEST =
|
|
|
|
endif
|
|
|
|
|
2001-06-26 18:01:21 +02:00
|
|
|
if ENABLE_TIMELOOP
|
2001-09-04 00:13:16 +02:00
|
|
|
timeloop = timeloop timeloop-closure
|
2001-06-26 18:01:21 +02:00
|
|
|
endif
|
2003-05-28 00:12:40 +02:00
|
|
|
noinst_PROGRAMS = testglib testgdate testgdateparser unicode-normalize unicode-collate $(timeloop)
|
2001-06-26 18:01:21 +02:00
|
|
|
testglib_LDADD = $(libglib)
|
2001-10-13 07:54:10 +02:00
|
|
|
patterntest_LDADD = $(libglib)
|
2001-06-26 18:01:21 +02:00
|
|
|
testgdate_LDADD = $(libglib)
|
|
|
|
testgdateparser_LDADD = $(libglib)
|
2001-07-02 02:49:21 +02:00
|
|
|
unicode_normalize_LDADD = $(libglib)
|
|
|
|
unicode_collate_LDADD = $(libglib)
|
2001-06-26 18:01:21 +02:00
|
|
|
if ENABLE_TIMELOOP
|
|
|
|
timeloop_LDADD = $(libglib)
|
2001-09-04 00:13:16 +02:00
|
|
|
timeloop_closure_LDADD = $(libglib) $(libgobject)
|
2001-06-26 18:01:21 +02:00
|
|
|
endif
|
|
|
|
|
2001-07-02 02:49:21 +02:00
|
|
|
test_programs = \
|
2004-02-26 15:30:35 +01:00
|
|
|
atomic-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
array-test \
|
|
|
|
$(CXX_TEST) \
|
2004-02-14 01:23:36 +01:00
|
|
|
child-test \
|
2004-02-05 00:54:17 +01:00
|
|
|
completion-test \
|
2005-08-08 07:30:20 +02:00
|
|
|
convert-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
date-test \
|
|
|
|
dirname-test \
|
2003-07-26 11:24:46 +02:00
|
|
|
file-test \
|
2003-07-28 21:30:05 +02:00
|
|
|
env-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
gio-test \
|
|
|
|
hash-test \
|
|
|
|
iochannel-test \
|
2005-01-19 15:14:27 +01:00
|
|
|
keyfile-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
list-test \
|
2001-11-02 03:56:08 +01:00
|
|
|
mainloop-test \
|
2005-06-25 05:38:32 +02:00
|
|
|
mapping-test \
|
2003-09-12 02:17:02 +02:00
|
|
|
markup-escape-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
module-test \
|
|
|
|
node-test \
|
2004-08-02 23:40:40 +02:00
|
|
|
option-test \
|
2003-05-28 00:12:40 +02:00
|
|
|
patterntest \
|
|
|
|
printf-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
queue-test \
|
|
|
|
qsort-test \
|
|
|
|
rand-test \
|
|
|
|
relation-test \
|
|
|
|
shell-test \
|
|
|
|
slist-test \
|
|
|
|
spawn-test \
|
Ignore the G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully
2002-11-17 Tor Lillqvist <tml@iki.fi>
* glib/gspawn-win32.c (g_spawn_async_with_pipes): Ignore the
G_SPAWN_DO_NOT_REAP_CHILD flag, can't be meaninfully implemented
on Windows, at least not now. Always pass dont_wait as TRUE to
do_spawn_with_pipes(). The semantics of the dont_wait parameter is
very different from the semantics of the intermediate_child
parameter to fork_exec_with_pipes() in the Unix version. This
fixes a serious bug, g_spawn_async() in fact behaved
synchronously.
(do_spawn_with_pipes, do_spawn): Rename from
fork_exec_with_pipes() and do_exec(), those names were from the
Unix bersion, and misleading.
(close_and_invalidate): Don't try to close invalid fds.
* glib/gspawn.c (g_spawn_async_with_pipes): Add warning about
Windows behaviour. There is no fork(), so the child_setup()
function is in fact called in the parent.
* glib/gspawn-win32-helper.c (WinMain): Insert spaces in argv
debugging output.
* tests/spawn-test-win32-gui.c: New file. Test program to be
linked as a GUI application. Behaves differently depending on how
invoked (by spawn-test).
* tests/spawn-test.c (run_tests): On Win32, run the
spawn-test-win32-gui program, too, in several ways, synchronously
and asynchronously.
* tests/Makefile.am: Corresponding change.
2002-11-17 04:52:55 +01:00
|
|
|
$(spawn_test_win32_gui) \
|
2001-07-02 02:49:21 +02:00
|
|
|
strfunc-test \
|
|
|
|
string-test \
|
2001-10-24 20:00:11 +02:00
|
|
|
strtod-test \
|
2001-07-02 02:49:21 +02:00
|
|
|
thread-test \
|
|
|
|
threadpool-test \
|
|
|
|
tree-test \
|
|
|
|
type-test \
|
|
|
|
unicode-caseconv \
|
2001-08-26 23:39:47 +02:00
|
|
|
unicode-encoding \
|
2004-11-24 16:54:20 +01:00
|
|
|
utf8-validate \
|
2001-08-26 23:39:47 +02:00
|
|
|
uri-test
|
1999-01-03 04:42:59 +01:00
|
|
|
|
2000-12-08 22:04:52 +01:00
|
|
|
test_scripts = run-markup-tests.sh
|
|
|
|
|
|
|
|
test_script_support_programs = markup-test
|
|
|
|
|
|
|
|
check_PROGRAMS = $(test_programs) $(test_script_support_programs)
|
|
|
|
|
|
|
|
TESTS = $(test_programs) $(test_scripts)
|
2001-11-27 18:31:12 +01:00
|
|
|
TESTS_ENVIRONMENT = srcdir=$(srcdir) \
|
2005-02-08 16:14:31 +01:00
|
|
|
LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
|
|
|
|
MALLOC_CHECK_=2
|
1999-01-03 04:42:59 +01:00
|
|
|
|
2001-12-22 09:29:06 +01:00
|
|
|
progs_ldadd = $(EFENCE) $(libglib) $(EFENCE)
|
2003-03-04 11:10:48 +01:00
|
|
|
thread_ldadd = $(libgthread) $(G_THREAD_LIBS) $(progs_ldadd)
|
|
|
|
module_ldadd = $(libgmodule) $(G_MODULE_LIBS) $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
|
2004-02-26 15:30:35 +01:00
|
|
|
atomic_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
array_test_LDADD = $(progs_ldadd)
|
2004-02-14 01:23:36 +01:00
|
|
|
child_test_LDADD = $(thread_ldadd)
|
2004-02-05 00:54:17 +01:00
|
|
|
completion_test_LDADD = $(progs_ldadd)
|
2005-08-08 07:30:20 +02:00
|
|
|
convert_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
date_test_LDADD = $(progs_ldadd)
|
|
|
|
dirname_test_LDADD = $(progs_ldadd)
|
2003-07-26 11:24:46 +02:00
|
|
|
file_test_LDADD = $(progs_ldadd)
|
2003-07-28 21:30:05 +02:00
|
|
|
env_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
gio_test_LDADD = $(progs_ldadd)
|
|
|
|
hash_test_LDADD = $(progs_ldadd)
|
|
|
|
iochannel_test_LDADD = $(progs_ldadd)
|
2005-01-19 15:14:27 +01:00
|
|
|
keyfile_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
list_test_LDADD = $(progs_ldadd)
|
|
|
|
mainloop_test_LDADD = $(thread_ldadd)
|
|
|
|
markup_test_LDADD = $(progs_ldadd)
|
2005-06-25 05:38:32 +02:00
|
|
|
mapping_test_LDADD = $(progs_ldadd)
|
2003-09-12 02:17:02 +02:00
|
|
|
markup_escape_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
module_test_LDADD = $(module_ldadd) $(module_test_exp)
|
2003-03-04 11:10:48 +01:00
|
|
|
module_test_LDFLAGS = $(G_MODULE_LDFLAGS)
|
2001-12-22 09:29:06 +01:00
|
|
|
node_test_LDADD = $(progs_ldadd)
|
2004-08-02 23:40:40 +02:00
|
|
|
option_test_LDADD = $(progs_ldadd)
|
2003-05-28 00:12:40 +02:00
|
|
|
printf_test_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
queue_test_LDADD = $(progs_ldadd)
|
|
|
|
qsort_test_LDADD = $(progs_ldadd)
|
|
|
|
rand_test_LDADD = $(progs_ldadd)
|
|
|
|
relation_test_LDADD = $(progs_ldadd)
|
|
|
|
shell_test_LDADD = $(progs_ldadd)
|
|
|
|
slist_test_LDADD = $(progs_ldadd)
|
|
|
|
spawn_test_LDADD = $(progs_ldadd)
|
|
|
|
strfunc_test_LDADD = $(progs_ldadd)
|
|
|
|
string_test_LDADD = $(progs_ldadd)
|
|
|
|
strtod_test_LDADD = $(progs_ldadd) -lm
|
|
|
|
thread_test_LDADD = $(thread_ldadd)
|
|
|
|
threadpool_test_LDADD = $(thread_ldadd)
|
|
|
|
tree_test_LDADD = $(progs_ldadd)
|
|
|
|
type_test_LDADD = $(progs_ldadd)
|
|
|
|
unicode_encoding_LDADD = $(progs_ldadd)
|
|
|
|
unicode_caseconv_LDADD = $(progs_ldadd)
|
2004-11-24 16:54:20 +01:00
|
|
|
utf8_validate_LDADD = $(progs_ldadd)
|
2001-12-22 09:29:06 +01:00
|
|
|
uri_test_LDADD = $(progs_ldadd)
|
1999-01-03 04:42:59 +01:00
|
|
|
|
Determine the suffix of the shared librarries for this system. This is
2000-12-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Determine the suffix of the shared librarries for
this system. This is done analogous to
ltconfig.sh. G_MODULE_SUFFIX in glibconfig.h is set to either
"sl", "dll", or (most often) "so".
* tests/Makefile.am, tests/module-test.c,
tests/libmoduletestplugin_a.c, tests/libmoduletestplugin_b.c:
Added new testcase for gmodule. This is mostly copied from
gmodule/testgmodule.c, but unlike that is is quiet. (Why BTW are
some tests that verbose, not to say loquacious...)
* gmodule.c: Make g_module_open more tolerant wrt to the module
name. First it tries to open the module as named, if that fails,
it checks, whether it is a libtool archive and parses it, if that
fails it appends the systems shared library suffix
(i.e. ".so") (if not already found) and tries again and if that
fails it tries to append the ".la" libtool suffix (if not already
found) and parses it.
* gmodule.c: Lock recursive mutex during most module functions for
safety.
* gmodule-dl.c: Return an error from _g_module_symbol only, if
dlerror says so. All other functions return an error as well, if
dlerror returns NULL.
* testgmodule.c: Thanks to the above change the #ifdefs have
vanished.
* glib/glib-sections.txt: Added G_MODULE_SUFFIX.
* glib/tmpl/modules.sgml: Updated.
2000-12-22 14:44:25 +01:00
|
|
|
lib_LTLIBRARIES = libmoduletestplugin_a.la libmoduletestplugin_b.la
|
|
|
|
|
|
|
|
# Prevent those libs from being installed
|
|
|
|
install-libLTLIBRARIES:
|
|
|
|
:
|
|
|
|
|
|
|
|
libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c
|
2003-03-04 11:10:48 +01:00
|
|
|
libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(libdir)
|
|
|
|
libmoduletestplugin_a_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
|
Determine the suffix of the shared librarries for this system. This is
2000-12-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Determine the suffix of the shared librarries for
this system. This is done analogous to
ltconfig.sh. G_MODULE_SUFFIX in glibconfig.h is set to either
"sl", "dll", or (most often) "so".
* tests/Makefile.am, tests/module-test.c,
tests/libmoduletestplugin_a.c, tests/libmoduletestplugin_b.c:
Added new testcase for gmodule. This is mostly copied from
gmodule/testgmodule.c, but unlike that is is quiet. (Why BTW are
some tests that verbose, not to say loquacious...)
* gmodule.c: Make g_module_open more tolerant wrt to the module
name. First it tries to open the module as named, if that fails,
it checks, whether it is a libtool archive and parses it, if that
fails it appends the systems shared library suffix
(i.e. ".so") (if not already found) and tries again and if that
fails it tries to append the ".la" libtool suffix (if not already
found) and parses it.
* gmodule.c: Lock recursive mutex during most module functions for
safety.
* gmodule-dl.c: Return an error from _g_module_symbol only, if
dlerror says so. All other functions return an error as well, if
dlerror returns NULL.
* testgmodule.c: Thanks to the above change the #ifdefs have
vanished.
* glib/glib-sections.txt: Added G_MODULE_SUFFIX.
* glib/tmpl/modules.sgml: Updated.
2000-12-22 14:44:25 +01:00
|
|
|
|
|
|
|
libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c
|
2003-03-04 11:10:48 +01:00
|
|
|
libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(libdir)
|
|
|
|
libmoduletestplugin_b_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
|
1999-06-18 18:36:25 +02:00
|
|
|
|
2000-10-16 03:02:19 +02:00
|
|
|
dist-hook: $(BUILT_EXTRA_DIST)
|
|
|
|
files='$(BUILT_EXTRA_DIST)'; \
|
|
|
|
for f in $$files; do \
|
|
|
|
if test -f $$f; then d=.; else d=$(srcdir); fi; \
|
|
|
|
cp $$d/$$f $(distdir) || exit 1; done
|
2000-11-17 21:44:24 +01:00
|
|
|
mkdir $(distdir)/markups; \
|
|
|
|
for f in $(srcdir)/markups/* ; do \
|
|
|
|
cp $$f $(distdir)/markups; \
|
2000-12-08 22:04:52 +01:00
|
|
|
done
|
2003-03-04 11:10:48 +01:00
|
|
|
|
2005-06-10 17:48:25 +02:00
|
|
|
DISTCLEANFILES = iochannel-test-outfile \
|
2005-06-30 23:01:58 +02:00
|
|
|
file-test-get-contents \
|
|
|
|
maptest \
|
|
|
|
mapchild
|