Commit Graph

10957 Commits

Author SHA1 Message Date
Matthias Clasen
ca6a985039 Improve test coverage in the thread tests
Use g_thread_new_full() in some places.
2011-10-04 00:46:10 -04:00
Matthias Clasen
e6fa27a5f8 Improve test coverage in the GString tests 2011-10-04 00:45:42 -04:00
Matthias Clasen
fc32480658 Improve testcoverage in the rec-mutex test
Test g_rec_mutex_trylock() in both locked and unlocked cases.
2011-10-04 00:44:58 -04:00
Matthias Clasen
823e32655e Add a few more tests
This brings test coverage for glist.c and glist.c to the
coveted 100% lines mark.
2011-10-03 23:55:02 -04:00
Matthias Clasen
1fe4429318 Remove bits of dead code identified by coverage tests
These lines could were not hit by our tests, and examination
of the code reveals that they can't ever be hit.
2011-10-03 23:54:08 -04:00
Matthias Clasen
b74f46db6b Add some more thread tests 2011-10-03 22:25:47 -04:00
Ryan Lortie
070aefcf59 GAsyncQueue: properly set free function
The copying of code from g_async_queue_new() to g_async_queue_new_full()
in ef08aa786b copied the setting of the
free function to NULL (instead of the one passed in by the user).

Fix that up so that the test passes again.

https://bugzilla.gnome.org/show_bug.cgi?id=660843
2011-10-03 22:18:01 -04:00
David Zeuthen
3f982cb9ab GUnixMountPoint: expose options
Make the options from an /etc/fstab entry available as public API -
this can be used to support options such as

 comment=gvfs.name=Foo\040Bar

to e.g. set the name of an fstab mount in the UI to "Foo Bar".

https://bugzilla.gnome.org/show_bug.cgi?id=660536

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-03 14:06:47 -04:00
Ryan Lortie
3106391694 Revert "GSettings: don't abort on missing schemas"
This reverts commit c841c2ce3f.

This approach has been an unmitigated disaster.  We're getting all sorts
of crashes due to functions that are returning NULL because they can't
find the schema for the default value.  The people who get these crashes
are then confused about the root cause of the problem and waste a lot of
time trying to figure it out.

Until we find a better solution, we should go back to what we had
before.

https://bugzilla.gnome.org/show_bug.cgi?id=655366
2011-10-03 10:19:38 -04:00
Matthias Clasen
9d989c7b8a Cosmetics 2011-10-02 23:53:56 -04:00
Matthias Clasen
fa6710ab6f Documentation fixes 2011-10-02 23:43:45 -04:00
Matthias Clasen
65b84bb7d0 Fix doc build
The markup here was not only broken, it was also unnecessary,
since gtk-doc knows to apply <function></function> tags to things
that end with () already.
2011-10-02 23:43:45 -04:00
Ryan Lortie
65056180dd locks: Add initialisation notes
For each of the 4, mention that static storage or _init() is needed.
2011-10-02 23:37:20 -04:00
Ryan Lortie
c5634df6d3 locks: change the ABI just a bit
Add a little bit more room in the ABI for our synchronisation primatives
since we're going to need it when we add native implementations on
Linux.

Also: rename the pointer field and add /*< private >*/ annotations.
2011-10-02 22:33:11 -04:00
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