Commit Graph

3204 Commits

Author SHA1 Message Date
Matthias Clasen
c917202552 GDataList: don't hold the bitlock over callbacks
g_datalist_id_clear_i was dropping the dataset lock around
the destroy notifies, but kept the bitlock. This was causing
deadlocks when finalizing widgets.
2011-06-06 23:25:42 -04:00
Chun-wei Fan
405b4ff4f4 Update the year in the *.rc.in files
Sorry this change came a bit late...
2011-06-07 08:55:31 +08:00
Chun-wei Fan
fba436f2cb Fix gatomic.c compilation on Windows (MSVC)
-windows.h must be included for the functions[1] to be found during
 compilation
-For Win32(x86), the InterlockedAnd, InterlockedOr and InterlockedXor
 functions need to be preceded with an underscore. This is mandated
 by the "For the x86 architecture..." clause under "Remarks"[2]
-This will close Bug 652000

[1]:http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
[2]:http://msdn.microsoft.com/en-us/library/ms683516(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/ms683626(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/ms684021(v=vs.85).aspx
2011-06-07 08:20:15 +08:00
Colin Walters
a6f09e104c GBuffer: Suffix header with private.h
This makes it clearer it's not public API yet.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-06 09:58:21 -04:00
Matthias Clasen
782cf86f12 GMappedFile: improve test coverage 2011-06-06 01:14:23 -04:00
Matthias Clasen
698bb5d962 GKeyFile: improve test coverage 2011-06-06 01:14:00 -04:00
Matthias Clasen
7cf16c3094 GConvert: improve test coverage 2011-06-06 01:13:46 -04:00
Matthias Clasen
e02d8165d9 Improve GChecksum test coverage 2011-06-06 01:13:26 -04:00
Matthias Clasen
4971c43da8 GMappedFile: remove nonatomic accesses to ref_count 2011-06-06 01:04:19 -04:00
Matthias Clasen
ae96118395 Improve test coverage of gtimezone.c 2011-06-06 00:31:52 -04:00
Matthias Clasen
f0b14653f8 Improve test coverage of GVariant 2011-06-06 00:31:40 -04:00
Matthias Clasen
70c082127f Improve test coverage of glist.c 2011-06-06 00:31:24 -04:00
Matthias Clasen
3e93fa7a25 Improve test coverage of glib-unix.c 2011-06-06 00:31:06 -04:00
Matthias Clasen
bb0cbc2ae1 Improve test coverage of gurifuncs.c 2011-06-06 00:30:50 -04:00
Matthias Clasen
059fa31ad1 Improve test coverage
Duplicate the atomic tests for the functions, and
test the new atomic operations as well.
2011-06-06 00:28:38 -04:00
Matthias Clasen
a79a5a6202 No need to have two variants of errno-to-GError 2011-06-05 22:20:18 -04:00
Matthias Clasen
594bf7460a Fix parameter documentation for many functions
Use the opt-out mechanism introduced in gtk-doc 1.16 to work
around problems with the _utf8 renaming games that the win32
port is playing in our headers.

https://bugzilla.gnome.org/show_bug.cgi?id=638449
2011-06-04 14:43:52 -04:00
Matthias Clasen
75f7eef9cd Fix doc typos
Now with fewer broken links...
2011-06-04 14:43:52 -04:00
Paolo Bonzini
c5d9a46394 avoid quadratic behavior of GMainLoop when all fd's have the same priority
https://bugzilla.gnome.org/show_bug.cgi?id=640518
2011-06-04 00:00:24 -04:00
Matthias Clasen
1e88c5321c Add a test for the previous fix 2011-06-03 23:38:46 -04:00
Matthias Clasen
77be95cdce GRand: avoid overflow
Otherwise, g_random_double_range (-G_MAXDOUBLE, G_MAXDOUBLE)
doesn't work as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=502560
2011-06-03 23:37:23 -04:00
Matthias Clasen
deed4dd36b g_mkdir_with_parents: cope with dirs popping into existence
Don't bail out if a directory suddenly turns out to exist
after all. Proposed in bug 612729.
2011-06-03 22:45:51 -04:00
Mikhail Zabaluev
69efeee287 Made g_utf8_to_ucs4_fast() even faster
https://bugzilla.gnome.org/show_bug.cgi?id=619435
2011-06-03 22:31:39 -04:00
Mikhail Zabaluev
1b101a3873 Added performance tests for UTF-8 decoding functions
https://bugzilla.gnome.org/show_bug.cgi?id=619418
2011-06-03 22:28:34 -04:00
Matthew Barnes
f065d7d60e Have g_queue_remove() return a boolean
g_queue_remove() should return a boolean so callers can verify that an
element was found and removed, as in the following example:

    if (g_queue_remove (queue, referenced_object))
        g_object_unref (referenced_object);

Similarly, g_queue_remove_all() should return the number of elements
found and removed.

https://bugzilla.gnome.org/show_bug.cgi?id=632294
2011-06-03 22:04:31 -04:00
Wim Taymans
496157ffd3 gthread: avoid locking in _get_mutex_impl
When getting the mutex implementation of a static mutex, avoid taking the global
lock every time but only take the lock when there was no mutex and we need to
create one.

https://bugzilla.gnome.org/show_bug.cgi?id=599954
2011-06-03 21:42:51 -04:00
Alexander Larsson
fca330dafa Use g_atomic_pointer_or/and to set datalist flags
https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
1cceda49b6 Make g_datalist_get_data not look up the quark
Instead of converting the string to a quark and comparing quarks we
use the new lockless g_quark_to_string and just compare the quarks
in the datalist with the given string.

This means we avoid the global lock for string to quark. Additionally
most of the time the data list will be quite short, so the cost of
doing the sting comparisons is likely similar to that of the quark
hashtable lookup (which does at least one string comparison for a
successfull lookup).

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
7ae5e9c248 Make quark to string lockless
We do this by assigning to g_quarks atomically and leaking it when
replacing it atomically. Then its safe to consume the array
on the reader side (atomically).

Also, since we're leaking quarks on growing, bump the block size
so that we're not leaking as much. gtk3-demo allocates > 1500 quarks,
and gnome apps > 3000. I'm setting the block to 2048 which means no
leaks for small gtk3 apps and just one leak for gnome apps.

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Alexander Larsson
3f8638ce93 Make g_datalist not use a global lock and perform better
This implementation uses a per-list bitlock for user data, and a
simple array rather than a linked list which uses less memory and less
allocations. It also gets better cache behaviour since related things
are stored close to each other.

https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:19 -04:00
Ryan Lortie
df0b208831 Implement pointer sized bitlocks
Based on a patch from Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=651467
2011-06-03 20:50:18 -04:00
Ryan Lortie
1a80405a36 bitlock: hand-code assembly version for x86
The __sync_fetch_and_or() operation on x86 is a bit suboptimal when the
result isn't ignored.  Normally we could use the 'lock or' assembly
instruction to accomplish this, but this instruction discards the
previous value.

In order to work around this issue, GCC is forced to emit a
compare-and-exchange loop.

We can easily use the 'lock bts' instruction, though.  It can't be used
in the general case for __sync_fetch_and_or() but it works great for our
case (test and set a single bit).

I filed a bug against GCC[1] to get this exposed as a new intrinsic (or
have the optimiser detect the case) but until then we'll hand-code it on
x86 and amd64.

The uncontended case sees a 31% improvement on my test machine.

 [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49244

https://bugzilla.gnome.org/show_bug.cgi?id=651467
2011-06-03 17:33:39 -04:00
Giovanni Campagna
f2bd54d0c5 gvariant: fix introspection annotations
g_variant_get_strv and g_variant_get_bytestring return arrays that
are null terminated and have an explicit length. Since gjs doesn't
support (out) arrays with length, mark them also null-terminated
(but leave the length annotation, so pygobject can remove the argument)

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-03 16:39:43 -04:00
Colin Walters
c34a6a66e7 gmain: Consolidate UNIX signal init state handling
For a future signalfd() patch, it will be easier to handle if
we don't separate initialization from watching for a particular
signal.

https://bugzilla.gnome.org/show_bug.cgi?id=651725
2011-06-03 11:38:18 -04:00
Colin Walters
6ea274bca4 gmain: Clean up SIGCHLD handling
Unify it more with the rest of the signal handling code.  There's
no reason not to specify SA_RESTART and SA_NOCLDSTOP for flags
always, so just do it.

Remove unnecessary initialization, and push the internal API
towards just ensure_unix_signal_handler_installed_unlocked().

https://bugzilla.gnome.org/show_bug.cgi?id=651725
2011-06-03 11:38:18 -04:00
Hanro
16bdb12e6d gkeyfile: Only test file descriptors against -1
Windows CE at least will return other (valid) negative values.
2011-06-02 15:44:19 -04:00
Colin Walters
a06863de60 Add a boxed type for GVariantBuilder, mark GVariantIter as (skip)
Based on a patch by Giovanni Campagna <gcampagna@src.gnome.org>

From discussion, GVariantIter is not useful for bindings, but
GVariantBuilder may be.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-31 13:37:14 -04:00
Colin Walters
6af9dd5135 gutils.c: Annotation fixes 2011-05-31 13:25:09 -04:00
Colin Walters
581ed51f0d g_shell_parse_argv: Annotate 2011-05-31 13:10:28 -04:00
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
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