summaryrefslogtreecommitdiff
path: root/tests/refcount/objects.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix signedness warnings in tests/refcount/objects.cEmmanuel Fleury2021-05-041-1/+1
| | | | | | | | | | tests/refcount/objects.c: In function ‘main’: tests/refcount/objects.c:133:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘const unsigned int’} 133 | for (i = 0; i < n_threads; i++) { | ^ tests/refcount/objects.c:149:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘unsigned int’ 149 | for (i = 0; i < 2 * n_threads; i++) { | ^
* tests: Fix non-atomic access to some shared variablesPhilip Withnall2020-11-201-4/+4
| | | | | | | | | And drop the `volatile` qualifier from the variables, as that doesn’t help with thread safety. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #600
* tests: Various minor leak fixes in the GObject testsPhilip Withnall2018-06-291-0/+1
| | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* tests/: Include unistd.h on *NIX onlyChun-wei Fan2013-11-111-1/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=711047
* Improve gtype test coverageMatthias Clasen2013-05-291-0/+3
|
* Remove g_type_init() callsRyan Lortie2012-10-161-1/+0
| | | | | | | | | Very many testcases, some GLib tools (resource compiler, etc) and GApplication were calling g_type_init(). Remove those uses, as they are no longer required. https://bugzilla.gnome.org/show_bug.cgi?id=686161
* Drop g_thread_init from testsMatthias Clasen2012-04-021-1/+0
| | | | This is not needed anymore.
* Do not use static GTypeInfo and GInterfaceInfoNicola Fontana2011-11-291-1/+1
| | | | | | | | | Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED) and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and GInterfaceInfo structs, while tutorials and source code often use static variables. This commit consistently adopts the former method. https://bugzilla.gnome.org/show_bug.cgi?id=600161
* Fix compiler warningsDan Winship2011-05-021-1/+1
|
* Fixed up internal 'g_test*' names.Tim Janik2007-11-201-20/+20
| | | | | | | | | | | | * refcount/signals.c: * refcount/objects.c: * refcount/objects2.c: * refcount/closures.c: * refcount/properties.c: * refcount/properties2.c: changed namespace prefix from g_test_* to my_test_* to not clash with newly introduced g_test* API in glib. svn path=/trunk/; revision=5875
* tests/refcount/objects.c tests/refcount/properties.c Use g_usleep()Tor Lillqvist2005-08-021-1/+1
| | | | | | | | | 2005-08-02 Tor Lillqvist <tml@novell.com> * tests/refcount/objects.c * tests/refcount/properties.c * tests/refcount/signals.c: Use g_usleep() instead of sleep() for portability.
* test high contention on closure reference counts to trigger and catchTim Janik2005-08-011-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mon Aug 1 23:33:47 2005 Tim Janik <timj@imendio.com> * tests/refcount/closures.c: test high contention on closure reference counts to trigger and catch non-atomic updates. * tests/refcount/objects.c: * tests/refcount/objects2.c: * tests/refcount/properties.c: * tests/refcount/properties2.c: * tests/refcount/signals.c: fixed up test and threading fundamentals. variables accessed from all threads need to be volatile. context switches are enforced by using g_thread_yield(), not g_usleep(1) which may result in busy waits on some platforms. for testcode, always consider all warnings and critical messages fatal. issue the currently running program on stdout. improved progress indicators. * tests/refcount/properties.c: * tests/refcount/objects.c: don't overdo the number of testing threads to keep the testing machine usable, 2 threads can produce as much contention as 20 if executing the same code. * tests/refcount/signals.c: only start 1 thread per object. GObject doesn't provide mutually exclusive object access, but only mutually exclusive reference count modification. * tests/Makefile.am: added closures test.
* Make refcounting threadsafe by using atomic operations. (#166020, WimMatthias Clasen2005-07-151-0/+155
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)