Commit Graph

9933 Commits

Author SHA1 Message Date
Colin Walters
98ebc596cf gfileutils: Annotations for g_file_{get,set}_contents
These are actually byte arrays.
2011-05-31 12:00:41 -04:00
Colin Walters
2300be5be3 Consistently use G_GNUC_EXTENSION instead of __extension__
g-ir-scanner doesn't like __extension__, and while I can add it, since
we have this macro, we should be using it consistently.
2011-05-31 10:35:38 -04:00
muralis
a84e6f982f gthreadedresolver: fix hang on g_thread_pool_push() failure
In resolve_sync function in gthreadedresolver.c, if g_thread_pool_push
fails due to thread creation failure, we are just simply appending the
data to the queue of work to do. After the failure, we might wait
indefinitely in g_cond_wait. In case of g_thread_pool_push failure,
propagate the error so that this function does not blocks forever in
case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=651034
2011-05-31 08:56:50 -04:00
Carles Ferrando
fb34889871 [l10n]Updated Catalan (Valencian) translation 2011-05-29 14:04:16 +02:00
Jorge González
59098fcc9b Updated Spanish translation 2011-05-29 09:47:30 +02:00
Matthias Clasen
807d41b89b Documentation fixups 2011-05-29 00:05:07 -04:00
Matthias Clasen
85ab379ac6 Clean up includes 2011-05-28 23:27:24 -04:00
Matthias Clasen
23b6691428 Reduce excessive whitespace 2011-05-28 23:15:07 -04:00
Matthias Clasen
a3c3aaa499 Remove redundant comments
The comments in gthreadpool.h were duplicating the
doc comments in the sources.
2011-05-28 22:49:59 -04:00
Matthias Clasen
666adc2dc0 Volatile not necessary after all
I was temporarily confused.
2011-05-28 22:33:37 -04:00
Matthias Clasen
53f93aacf3 GTree: Declare ref_count as volatile 2011-05-28 22:03:05 -04:00
Matthias Clasen
a4f00f39da GAsyncQueue: Make ref_count a volatile gint 2011-05-28 22:02:13 -04:00
Matthias Clasen
a33abe9c21 GAsyncQueue: Remove excessive atomic operations
Almost every function was double-checking the ref count,
unnecessarily.
2011-05-28 21:43:45 -04:00
Matthias Clasen
edc7fde495 GArray: Avoid unncessary atomic accesses to refcounts
Not really necessary to double-check the ref-count.
2011-05-28 21:41:08 -04:00
Matthias Clasen
abf719362a GHash: Avoid nonatomic access to the reference count
Not really necessary to constantly double-check the ref
count, anyway.
2011-05-28 21:40:12 -04:00
Matthias Clasen
f12650392b Fix a typo 2011-05-28 21:14:36 -04:00
Matthias Clasen
d35e83d337 Documentation tweaks
Add Since tags, etc.
2011-05-28 21:12:52 -04:00
Neil Roberts
2df4750ace gsocket: Fix some cases of returning error without setting *error
g_socket_shutdown and g_socket_close were calling check_socket with a
NULL error parameter so any errors wouldn't get propagated up.

https://bugzilla.gnome.org/show_bug.cgi?id=651327
2011-05-28 19:46:15 -04:00
Neil Roberts
0703dbc21f gsocket: Fix the error message for a failed g_socket_shutdown
The GError message for g_socket_shutdown was reporting that it was
"Unable to create socket" which is presumably a cut-and-paste bug.

https://bugzilla.gnome.org/show_bug.cgi?id=651327
2011-05-28 19:46:14 -04:00
Antoine Jacoutot
56c0d0f384 Fix compile warnings on OpenBSD.
https://bugzilla.gnome.org/show_bug.cgi?id=651223
2011-05-28 18:59:38 -04:00
Matthias Clasen
05c7dcab37 Remove unnecessary casts
The new atomic implementations don't need these anymore to
avoid warnings.
2011-05-28 18:42:09 -04:00
Ryan Lortie
d09443fe20 optimise bitlocks with new atomic operations
Add a performance test for bitlocks.

Make use of the new g_atomic_int_{and,or} to avoid having to do the
usual compare-and-exchange loop.

On a test machine, the change increases performance from approximately
20 million uncontended acquire/releases per second to 31 million.
2011-05-28 17:39:12 -04:00
Ryan Lortie
858a328792 Fix futex(2) detection and use
Commit 22e7fc34c4 introduced a regression:
futexes were always disabled and the emulated codepath was always being
used.  That commit was in response to an originally buggy
implementationt hat wrote junk into config.h (but happened to be working
properly).

Fix up the mess and while we're at it, close bug #631231 by including
syscall.h from the correct location and using __NR_futex instead of
SYS_futex.

Closes #631231.
2011-05-28 17:27:12 -04:00
Ryan Lortie
8382135265 glib: Rewrite gatomic.[ch]
- remove all inline assembly versions

 - implement the atomic operations using either GCC intrinsics, the
   Windows interlocked API or a mutex-based fallback

 - drop gatomic-gcc.c since these are now defined in the header file.
   Adjust Makefile.am accordingly.

 - expand the set of operations: support 'get', 'set', 'compare and
   exchange', 'add', 'or', and 'xor' for both integers and pointers

 - deprecate g_atomic_int_exchange_and_add since g_atomic_int_add (as
   with all the new arithmetic operations) now returns the prior value

 - unify the use of macros: all functions are now wrapped in macros that
   perform the proper casts and checks

 - remove G_GNUC_MAY_ALIAS use; it was never required for the integer
   operations (since casting between pointers that only vary in
   signedness of the target is explicitly permitted) and we avoid the
   need for the pointer operations by using simple 'void *' instead of
   'gpointer *' (which caused the 'type-punned pointer' warning)

 - provide function implementations of g_atomic_int_inc and
   g_atomic_int_dec_and_test: these were strictly macros before

 - improve the documentation to make it very clear exactly which types
   of pointers these operations may be used with

 - remove a few uses of the now-deprecated g_atomic_int_exchange_and_add

 - drop initialisation of gatomic from gthread (by using a GStaticMutex
   instead of a GMutex)

 - update glib.symbols and documentation sections files

Closes #650823 and #650935
2011-05-28 16:10:44 -04:00
Matthias Clasen
2fb57ff46f Quiet down the build a bit 2011-05-28 14:29:08 -04:00
Matthias Clasen
ae85e3b7b6 Quell warnings from g_once_init_enter_impl 2011-05-28 13:59:20 -04:00
Matthias Clasen
f5bc2e00c7 Trivial: fix a variable name
It is indices, not indeces.
2011-05-28 13:57:47 -04:00
Simon McVittie
22cc6ce679 Add a regression test for GNOME#642026
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:42 -04:00
Simon McVittie
e83210425f GStaticPrivate: protect GRealThread.private_data with a bit-lock
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:41 -04:00
Simon McVittie
83f1b12388 Refactor GStaticPrivate accessors to facilitate protecting them with locks
* g_static_private_get: have a single entry and exit

* g_static_private_set: delay creation of GArray so the whole tail of
  the function can be under the private_data lock without risking
  deadlock with the g_thread lock; call the destructor last, after
  we could have unlocked

* g_static_private_free: choose next thread in list before accessing
  private_data, to keep all accesses together

* g_thread_cleanup: steal private_data first, then work exclusively with
  the stolen array (which doesn't need to be under a lock any more)

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:40 -04:00
Simon McVittie
b05f0b351c g_static_private_free: defer non-trivial destruction til after we unlock
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:40 -04:00
Simon McVittie
d5f0ec1e8e GRealThread: remove obsolete comment about gmain.c, which no longer has a copy
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=642026
Bug-NB: NB#257512
2011-05-28 10:00:39 -04:00
Daniel Mustieles
b6fd3c3dac Updated Spanish translation 2011-05-28 10:27:31 +02:00
Matthias Clasen
00734ef99f Add macro version for all atomic operations
Better to be consistent about this.
2011-05-28 00:16:39 -04:00
Matthias Clasen
7cf1122253 Use G_STATIC_ASSERT_EXPR for size checks in atomic macros
Also add the same size checks to the macros wrapping
gcc builtins.
2011-05-28 00:04:10 -04:00
Ryan Lortie
edd65baa6d Add a test case for atomic ops
Make sure that the macros work properly with the range of types that
they are documented to work with and ensure that no strict aliasing
warnings are issued (even at the highest warning level).

https://bugzilla.gnome.org/show_bug.cgi?id=650935
2011-05-27 23:00:14 -04:00
Ryan Lortie
c00ef0a17a Add G_STATIC_ASSERT_EXPR macro
https://bugzilla.gnome.org/show_bug.cgi?id=626549
2011-05-27 22:36:16 -04:00
Matthias Clasen
64d5a0404a GThread: expand the docs
Mention newer addition to the thread support in the introduction:
bit locks and one-time initialization.
2011-05-27 20:22:20 -04:00
Matthias Clasen
7d0eac03e9 glib-compile-schemas: write informational messages to stdout
The fact that we return 0 here makes it clear that this
is not considered an error, so it makes sense to not
write these messages to stderr.
Proposed by Antoine Jacoutot,
https://bugzilla.gnome.org/show_bug.cgi?id=650882
2011-05-27 18:30:45 -04:00
Colin Walters
dfcac7b23e g_variant_new_dict_entry: Fix documentation and annotations
Move @key to not be at the start of a line, otherwise g-ir-scanner
gets confused.

Also two annotation fixes.
2011-05-27 16:12:58 -04:00
Matthias Clasen
5345d21150 forgotten test 2011-05-27 16:09:34 -04:00
Giovanni Campagna
39ba9c8e49 g_variant_get_child_value: Add a precondition on length
Ensure callers get a warning if they pass a bad length.

Split into a separate commit and changed to order index before
n_children by Colin Walters <walters@verbum.org>
2011-05-27 16:05:56 -04:00
Giovanni Campagna
e61fa51fd5 GVariant: fix introspection annotations
Add transfer annotations for most functions, as well as some (array)
and (skip) for functions that use varargs.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-27 15:56:50 -04:00
Antoine Jacoutot
77f4f5aa02 Add glib credentials support to OpenBSD.
https://bugzilla.gnome.org/show_bug.cgi?id=650885
2011-05-27 14:22:56 -04:00
Antoine Jacoutot
2ee470a71f Don't hardcode path to true(1).
true(1) is not always installed under /bin so leave system() find
it in the PATH.

https://bugzilla.gnome.org/show_bug.cgi?id=651219
2011-05-27 12:00:41 -04:00
Matthias Clasen
5d7b67a6c3 Preserve consistency when removing all nodes from a hash table
During the recent refactorings of GHashTable a bug was introduced
where removing all nodes from a hash table would leave tombstones
behind, but make the counts appear like there are none.

Reported and tracked down by Carlos Garnacho,
https://bugzilla.gnome.org/show_bug.cgi?id=651141

This commit also adds a test that checks the internal consistency
of GHashTable over several insert/remove/remove-all operations.
2011-05-26 21:52:50 -04:00
David Schleef
b92861b5a0 main: Use public function in documentation
https://bugzilla.gnome.org/show_bug.cgi?id=651009
2011-05-26 20:56:51 -04:00
David Zeuthen
25440ce014 GDBusProxy: Mention gdbus-codegen in docs
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-26 10:18:44 -04:00
David Zeuthen
06f5de77f0 GDBusProxy: Fix incorrect locking
Pointed out by mclasen.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-26 10:07:38 -04:00
David Zeuthen
c0f4a63c89 GDBusProxy: Add locking and notes/guarantees about MT safety
This was discussed in

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-26 09:56:14 -04:00