Commit Graph

9916 Commits

Author SHA1 Message Date
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
David Zeuthen
7e0f890e38 GDBusProxy: Fix race condition when unsubscribing from signals
This was reported in bug 651133.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-26 09:26:29 -04:00
Richard Hughes
9936f961ba Correct the annotation for g_file_enumerator_get_container()
We don't ref the returned object, and alex has verified the gvfs implementation.
2011-05-26 12:37:36 +01:00
Marc-André Lureau
30672af7ff gthread: build unix tests only on unix
The build fails when compiling with mingw32. Correct the build of a
unix tests on unix only.

https://bugzilla.gnome.org/show_bug.cgi?id=649973
2011-05-26 11:19:20 +02:00
David Zeuthen
3f569d2b5b gdbus-codegen: Fix up example to not use non-existant method
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-24 07:34:30 -04:00
David Zeuthen
ab18737ead gdbus-codegen: Properly render @param and %TRUE in generated Docbook
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-24 00:27:43 -04:00
David Zeuthen
263ce3042c gdbus-codegen: Handle unexpected XML tags
This was reported in bug 650874. Add tests.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-23 23:23:10 -04:00
Giovanni Campagna
0aae977ac1 gdbusintrospection: fix introspection of DBus Introspection structures
Correctly mark fields as arrays (requires changing gobject-introspection
to pick those).

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-23 22:15:56 +02:00
Ray Strode
eabad1923e Revert "gsettings-tool: warn if setting a value fails"
This reverts commit ea57feff96.

It makes the gsettings tool fail any time it tries to set a
key to a value, that the key already has.

https://bugzilla.gnome.org/show_bug.cgi?id=641768
2011-05-23 13:40:02 -04:00
Antoine Jacoutot
ce0f7cafa1 Fix build with gcc-2.*.
https://bugzilla.gnome.org/show_bug.cgi?id=650884
2011-05-23 13:05:49 -04:00
Seán de Búrca
c61fd66e77 Updated Irish translation. 2011-05-23 00:38:11 -06:00
Matthias Clasen
77110304cc Cosmetic changes
Use inc/dec for refcounting.
2011-05-23 00:48:10 -04:00
Matthias Clasen
88f23fb1d9 Cosmetics
Use g_atomic_int_inc/dec instead of add(...,1/-1), since
this is the way refcounting is done elsewhere. Some other
cosmetic changes.
2011-05-23 00:40:33 -04:00
Matthias Clasen
b5056fbaf9 Simply symbols files
The grouping in files/headers is not used anymore, and
the function attributes neither. Adapt abicheck scripts
and .def file generation rules accordingly.
2011-05-23 00:21:06 -04:00
Matthias Clasen
dec7d41275 Improve atomic ops implementation
When using gcc builtins for atomic operations, provide them
as macros, so gcc can see the builtins and do optimizations.
This change gives considerable speedups in bitlocks, which
use atomic operations heavily, see bug 650458.

Also, don't define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED unconditionally
when using gcc builtins.

https://bugzilla.gnome.org/show_bug.cgi?id=617491
2011-05-22 16:31:43 -04:00
Matthias Clasen
9255350a70 Add some atomic ops tests 2011-05-22 01:29:22 -04:00
Matthias Clasen
22e7fc34c4 Fix HAVE_FUTEX definition 2011-05-22 00:33:05 -04:00
Matthias Clasen
f924384634 Trivial: fix a typo 2011-05-21 20:56:04 -04:00