Commit Graph

10843 Commits

Author SHA1 Message Date
Ryan Lortie
2a677d1370 locks: drop _INIT macros
All locks are now zero-initialised, so we can drop the G_*_INIT macros
for them.

Adjust various users around GLib accordingly and change the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Ryan Lortie
3315aee709 Re-enable 'include' testcase
The bug is fixed now.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Ryan Lortie
e081eadda5 GThread posix: switch to Windows ABI
Modify the POSIX implementation of the synchronisation primatives to use
the same ABI as Windows: one pointer for each type.

This frees us from having to #include <pthread.h> and avoids the problem
with pthread_rwlock_t not being defined under certain compiler defines.

A few more changes are expected to the ABI -- they will be committed
separately.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Matthias Clasen
151756631d Don't use g_thread_foreach in tests 2011-10-02 22:31:45 -04:00
Matthias Clasen
3d4846d923 Deprecate GStaticPrivate and g_thread_foreach
This commit moves GStaticPrivate, g_thread_foreach and all
related functions and variables to gthread-deprecated.c. We
introduce some internal API to make this possible.

g_thread_foreach is not a very useful function, since there is
virtually nothing you can do with a GThread*, and implementing
it requires us to keep a list of threads around.

GStaticPrivate has been made redundant by adding comparable
capabilities to GPrivate.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:59 -04:00
Matthias Clasen
12287c8cc7 Don't put threads created with g_thread_new() on the list
This lets us avoid the overhead of maintaining the global
list in the non-deprecated case.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:58 -04:00
Matthias Clasen
1909d2398a Make thread names useful in a debugger
Associate the name with the system thread, so that debuggers
can see it. This is currently only implemented for Linux, using
prctl.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:58 -04:00
Matthias Clasen
0d1a92ca3d Add new thread creation API
Deprecate both g_thread_create functions and add
g_thread_new() and g_thread_new_full(). The new functions
expect a name for the thread.

Change GThreadPool, GMainContext and GDBus to create named threads.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:58 -04:00
Matthias Clasen
bc67c23bf9 Define GLIB_COMPILATION when building libgthread.so
This is necessary, because gthreadprivate.h can only be
included inside GLib, otherwise single-include guards trigger.
2011-10-02 22:11:34 -04:00
Matthias Clasen
34ce4dd032 Replace static privates by privates
GStaticPrivate is heading for deprecation soon, and GPrivate
can replace these uses now.
2011-10-02 22:11:33 -04:00
Ryan Lortie
6f71151823 win32: fix GPrivate fallout
Fix minor mistake in win32 GPrivate code.
2011-10-02 21:31:45 -04:00
Ryan Lortie
cdd43d43c9 locks: rename a bunch of parameters 2011-10-02 20:24:18 -04:00
Ryan Lortie
8e43470c38 Stop dithering over GPrivate
Take out the half-private g_private_init() stuff and replace it with a
G_PRIVATE_INIT macro that allows specifying a GDestroyNotify.

Expose the GPrivate structure in a public header.

Add a g_private_replace() to (sort of) match the functionality of
g_static_mutex_set().

Improve the documentation.

Deprecate g_private_new().
2011-10-02 20:04:03 -04:00
Matthias Clasen
7a75f56aa1 Add a few comments 2011-10-02 19:10:16 -04:00
Matthias Clasen
7df7c53557 Add another GCond test
This test shows how to implement a barrier using a GCond.
2011-10-02 19:09:24 -04:00
Matthias Clasen
1a5cc98ca2 Rework the way GStaticPrivate data is freed
To avoid iterating threads in g_static_private_free(), defer freeing
the per-thread data to thread exit. The one complication here is
that it is possible for the static private index to be reused while
'old' data is still around. To deal with that case, store the 'owner'
with each per-thread data node, and free old data in
g_static_private_get() if the owner doesn't match. The remaining
possibility that a private index could be reused by a GStaticPrivate
with the same address is sufficiently unlikely that we can probably
ignore it.

With this change, per-thread data is now truly private again,
and we can drop the lock for it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 18:32:41 -04:00
Matthias Clasen
6a31cc66cd Whitespace fixes 2011-10-02 17:11:42 -04:00
Matthias Clasen
3c02c64474 Clean up includes 2011-10-02 17:05:14 -04:00
Matthias Clasen
6d2b2ccaa0 Add tests for GPrivate and GStaticPrivate 2011-10-02 16:51:32 -04:00
Javier Jardón
3659ca99f5 tests: Use G_VALUE_INIT 2011-10-02 17:22:57 +01:00
Javier Jardón
91713e950f docs: Use G_VALUE_INIT 2011-10-02 17:22:18 +01:00
Ryan Lortie
406f7d2b39 mutex testcase: add a performance test
Add a reasonable performance test for uncontended and contended cases.
2011-10-02 00:13:18 -04:00
Matthias Clasen
6ef022bbb3 Move all hash functions to ghash.c
This matches their location in the headers.
2011-10-02 00:08:54 -04:00
Matthias Clasen
e7ca67f20c GHash: Cosmetic changes 2011-10-02 00:08:13 -04:00
Matthias Clasen
ed325b1879 One forgotten moved doc 2011-10-01 23:38:52 -04:00
Matthias Clasen
10d86cda02 Move GStringChunk into its own files 2011-10-01 23:38:23 -04:00
Matthias Clasen
0e8bcc3ed7 Move GString docs inline 2011-10-01 23:27:45 -04:00
Matthias Clasen
459b14d89a GString: cosmetic cleanups 2011-10-01 23:23:40 -04:00
Matthias Clasen
7154d44c5c Move file utility docs inline 2011-10-01 23:03:09 -04:00
Matthias Clasen
ca77b0e252 Move string utility docs inline 2011-10-01 22:48:27 -04:00
Matthias Clasen
793ff83527 Move test docs inline 2011-10-01 22:00:41 -04:00
Matthias Clasen
9d3b37ac3f Move keyfile docs inline 2011-10-01 21:03:14 -04:00
Matthias Clasen
3d814e7a2a GAsyncQueue: simplify an internal function
g_cond_timed_wait() behaves like g_cond_wait() when given
NULL, so no need have different branches for that in
g_async_queue_pop_intern_unlocked().
2011-10-01 20:22:47 -04:00
Matthias Clasen
8c5400ff45 GAsyncQueue: internal cleanup
Turn the 'try' parameter of g_async_queue_pop_intern_unlocked
into a 'wait', for better alignment with the GCond api.
2011-10-01 20:22:47 -04:00
Matthias Clasen
793cf54275 GAsyncQueue: embed the GCond
Use g_cond_init/clear, now that we have them.
2011-10-01 20:22:46 -04:00
Matthias Clasen
ef08aa786b GAsyncQueue: Cosmetic fixes
Mostly doc formatting and whitespace fixes.
2011-10-01 20:22:46 -04:00
Matthias Clasen
93abf20d3b GAsyncQueue: Move private API to a private header 2011-10-01 20:22:46 -04:00
Matthias Clasen
b17b02da79 GThreadPool: cosmetic cleanups
Mostly documentation and formatting trivial, but also add
boolean return types to GError taking functions.
2011-10-01 20:22:46 -04:00
Matthias Clasen
81e161edf2 GThread: cosmetic fix
Explicitly include gthread.h, don't rely on gthreadprivate.h
to pull it in.
2011-10-01 20:22:45 -04:00
Nguyễn Thái Ngọc Duy
5135241633 Updated Vietnamese translation 2011-10-02 11:21:29 +11:00
Nguyễn Thái Ngọc Duy
98818afa08 po/vi: import from Damned Lies 2011-10-02 11:21:28 +11:00
Matthias Clasen
1af5ac0179 Add an index for 2.32 api additions 2011-10-01 13:47:54 -04:00
Matthias Clasen
b4dc4902c6 Mark g_thread_create_with_stack_size as new API 2011-10-01 13:47:09 -04:00
Ryan Lortie
65b7a20c67 GSettings schemas: allow for zero items in schema
GVDB deals with empty lists by returning NULL for the list instead of a
zero-length (non-NULL) strv.  We can work around that in GSettingsSchema
by checking for the NULL case and treating it like a zero-length list.

https://bugzilla.gnome.org/show_bug.cgi?id=660147
2011-10-01 09:34:44 -04:00
Jasper Lievisse Adriaanse
e147d7aa2f Fix URL to strlcpy(3) manpage in comment. 2011-10-01 10:46:52 +02:00
Simon McVittie
c48a0d8813 markup-subparser test: use a real GError domain
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
2011-09-30 13:17:27 +01:00
Simon McVittie
7aad93c5b4 sleepy-stream test: use a real GError domain
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
2011-09-30 13:17:27 +01:00
Simon McVittie
e60e4999b9 g_dbus_error_encode_gerror: don't segfault on bad domains
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=660371
2011-09-30 13:17:27 +01:00
Matthias Clasen
5156d1b2d4 Prevent data loss in gdesktopappinfo.c
Don't loose the content of mimeapps.list when it doesn't contain
a [Added Associations] group. Pointed out by Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=660130
2011-09-29 23:42:58 -04:00
Matthias Clasen
e6c76d9fd4 Clean up atomic cruft
Nothing is using these defines anymore, and the messages
are misleading. Based on a patch by Kean Johnston.

https://bugzilla.gnome.org/show_bug.cgi?id=660013
2011-09-29 23:20:09 -04:00