platform/upstream/glib.git
12 years agoUpdated Gujarati Translations
Sweta Kothari [Tue, 20 Sep 2011 08:01:07 +0000 (13:31 +0530)]
Updated Gujarati Translations

12 years agoGDBusObjectManagerServer: Add test for export_uniquely() method
David Zeuthen [Mon, 19 Sep 2011 21:31:21 +0000 (17:31 -0400)]
GDBusObjectManagerServer: Add test for export_uniquely() method

Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoGDBusObjectManagerServer: Use correct object path in export_uniquely() method
Matthew Barnes [Mon, 19 Sep 2011 20:45:05 +0000 (16:45 -0400)]
GDBusObjectManagerServer: Use correct object path in export_uniquely() method

In registration_data_export_interface(), the object_path is obtained using:

object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object));

But when exporting an object uniquely, the object_path is not assigned
to the GDBusObject until after all the interfaces are exported.
Therefore, registration_data_export_interface() is trying to export
the interface on the non-unique object path, which can lead to
run-time errors if an object already exists on that path.

Instead, registration_data_export_interface() should be passed the
object_path explicitly, as is done in
g_dbus_object_manager_server_export_unlocked().

Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoDon't close stream twice when splicing
Philip Withnall [Mon, 19 Sep 2011 08:13:52 +0000 (10:13 +0200)]
Don't close stream twice when splicing

Ensure that the output/target stream in a g_output_stream_splice_async()
operation is marked as closed if G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET is
passed to g_output_stream_splice_async(). This removes the possibility of
local FDs being closed twice because the stream's not marked as closed.

This is implemented by calling g_output_stream_close() from within
g_output_stream_splice_async() instead of calling the stream's close_fn()
directly.

Closes: bgo#659324

12 years agogbitlock: #include "gslice.h"
Ryan Lortie [Mon, 19 Sep 2011 02:20:08 +0000 (22:20 -0400)]
gbitlock: #include "gslice.h"

This is needed if we're doing emulated futexes.

12 years agoFix a merge accident
Matthias Clasen [Mon, 19 Sep 2011 02:14:19 +0000 (22:14 -0400)]
Fix a merge accident

12 years agoRemove unused header gdebug.h
Ryan Lortie [Sun, 18 Sep 2011 18:22:07 +0000 (14:22 -0400)]
Remove unused header gdebug.h

This was only included from gmessages.c.  Nuke the unused parts and
merge the rest into gmessages.c.

12 years agoDon't #include <glib/gslice.h> from gmem.h
Ryan Lortie [Sun, 18 Sep 2011 22:59:20 +0000 (18:59 -0400)]
Don't #include <glib/gslice.h> from gmem.h

It looks like this was done just to help people port from gmem to
gslice, but nothing in this header actually requires gslice.h to be
included.

12 years agoMove deprecated GCompletion to deprecated/
Ryan Lortie [Mon, 19 Sep 2011 00:36:30 +0000 (20:36 -0400)]
Move deprecated GCompletion to deprecated/

Keep the docs for now, though.  We'll remove them after a few more
cycles.

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

12 years agoMove deprecated GRel to deprecated/
Ryan Lortie [Mon, 19 Sep 2011 00:31:09 +0000 (20:31 -0400)]
Move deprecated GRel to deprecated/

Keep the docs for now, though.  We'll remove them after a few more
cycles.

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

12 years agoMove GAllocator/GMemChunk to separate file
Ryan Lortie [Mon, 19 Sep 2011 00:17:59 +0000 (20:17 -0400)]
Move GAllocator/GMemChunk to separate file

Create a deprecated/ directory that we can start moving ancient chunks
of code to.  Start with GAllocator, GMemChunk and related APIs.

Also drop all mention of them from the docs.

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

12 years agoUpdated Serbian translation
Мирослав Николић [Mon, 19 Sep 2011 01:07:41 +0000 (03:07 +0200)]
Updated Serbian translation

12 years agoFix g_ascii_formatd tests
Matthias Clasen [Sun, 18 Sep 2011 18:50:31 +0000 (14:50 -0400)]
Fix g_ascii_formatd tests

The test was not changing to the locales it was looping over.

12 years agogsocks5proxy, gsocks4aproxy: simplify some error messages
Dan Winship [Sun, 18 Sep 2011 14:49:58 +0000 (10:49 -0400)]
gsocks5proxy, gsocks4aproxy: simplify some error messages

There's no need to include the exact max length in the error messages,
and it makes it look like the strings need to use ngettext() if you do.

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

12 years agoUpdated Bulgarian translation
Alexander Shopov [Sun, 18 Sep 2011 05:04:58 +0000 (08:04 +0300)]
Updated Bulgarian translation

12 years agoUse xlocale functions where available
Matthias Clasen [Sun, 18 Sep 2011 02:44:28 +0000 (22:44 -0400)]
Use xlocale functions where available

Implement g_ascii_strto{d,ll,ull} and g_ascii_formatd using
xlocale functions where available. This is slightly faster
and a lot less icky than our homegrown code.

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

12 years agoRemove redundant checks
Matthias Clasen [Sun, 18 Sep 2011 00:27:16 +0000 (20:27 -0400)]
Remove redundant checks

g_set_error() handles error == NULL, so no need to check.
Patch by Ignacio Casal Quinteiro.

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

12 years agoGMappedFile: return an error when trying to map a device
Matthias Clasen [Sat, 17 Sep 2011 23:58:28 +0000 (19:58 -0400)]
GMappedFile: return an error when trying to map a device

Previously, we were returning an empty buffer for all filenames
where fstat() gives a size of 0. But this is only appropriate
for regular files.

Also improve the documentation around this issue. Based on a
patch by Ryan Lortie.

Conflicts:

glib/tests/mappedfile.c

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

12 years agoglib-compile-schemas: remove --uninstall option
Ryan Lortie [Sat, 17 Sep 2011 23:11:10 +0000 (19:11 -0400)]
glib-compile-schemas: remove --uninstall option

This option does nothing as has been documented as "will be removed
soon" for the vast majority of its life.

12 years agoGVariant: avoid 'ARRAY_INFO' as function name
Ryan Lortie [Sat, 17 Sep 2011 21:32:42 +0000 (17:32 -0400)]
GVariant: avoid 'ARRAY_INFO' as function name

Turns out that ARRAY_INFO isn't such a great name for a function since
Windows appears to declare this symbol these days.  Use a different
name.

12 years agogmain: fix some win32 build errors
Ryan Lortie [Sat, 17 Sep 2011 21:32:18 +0000 (17:32 -0400)]
gmain: fix some win32 build errors

12 years agoUpdate Simplified Chinese translation.
Aron Xu [Sat, 17 Sep 2011 16:18:03 +0000 (16:18 +0000)]
Update Simplified Chinese translation.

12 years agoUpdated Serbian translation
Мирослав Николић [Fri, 16 Sep 2011 22:03:56 +0000 (00:03 +0200)]
Updated Serbian translation

12 years agogatomic: use pthread mutexes instead of GMutex
Ryan Lortie [Fri, 16 Sep 2011 21:50:13 +0000 (17:50 -0400)]
gatomic: use pthread mutexes instead of GMutex

GStaticMutex makes use of atomic operations to initialise itself.  We
were using GStaticMutex from the emulated case of gatomic.  Use pthreads
directly to avoid unbounded recursion in this case.

12 years agogdbus-codegen: Support Ugly_Case for given C namespace
David Zeuthen [Fri, 16 Sep 2011 20:01:13 +0000 (16:01 -0400)]
gdbus-codegen: Support Ugly_Case for given C namespace

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agogdbus-codegen: Single letter namespaces get dropped from symbol names
David Zeuthen [Fri, 16 Sep 2011 19:20:00 +0000 (15:20 -0400)]
gdbus-codegen: Single letter namespaces get dropped from symbol names

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years ago_g_dbus_worker_new: hold a ref until we have done the initial read
Simon McVittie [Mon, 12 Sep 2011 17:42:36 +0000 (18:42 +0100)]
_g_dbus_worker_new: hold a ref until we have done the initial read

Otherwise, we could use-after-free the GDBusWorker, if its last-unref
is immediately after _g_dbus_worker_new returns (before the worker thread
does its initial read).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoGDBusWorker: as a precaution, access 'stopped' boolean atomically
Simon McVittie [Mon, 12 Sep 2011 17:26:45 +0000 (18:26 +0100)]
GDBusWorker: as a precaution, access 'stopped' boolean atomically

This member is written in _g_dbus_worker_stop from arbitrary threads, and
read by the worker thread, so it should be accessed atomically.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoRegression test for closing a stream, slowly, while a message is queued
Simon McVittie [Mon, 12 Sep 2011 17:24:24 +0000 (18:24 +0100)]
Regression test for closing a stream, slowly, while a message is queued

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoGDBusWorker: annotate more functions with lock/pending state
Simon McVittie [Thu, 8 Sep 2011 16:21:02 +0000 (17:21 +0100)]
GDBusWorker: annotate more functions with lock/pending state

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoGDBusConnection: delegate to the worker to close the stream
Simon McVittie [Tue, 13 Sep 2011 16:31:27 +0000 (17:31 +0100)]
GDBusConnection: delegate to the worker to close the stream

We can't safely close the output part of the I/O stream until any
pending write or flush has been completed. In the worst case, this could
lead to an assertion failure in the worker (when the close wins the
race) or not closing the stream at all (when the write wins the race).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoGDBusWorker: combine num_writes_pending with flush_pending
Simon McVittie [Tue, 13 Sep 2011 16:37:33 +0000 (17:37 +0100)]
GDBusWorker: combine num_writes_pending with flush_pending

num_writes_pending was a counter, but it only took values 0 or 1, so make
it a boolean: it would never make sense to be trying to write out two
messages at the same time (they'd get interleaved).

Similarly, we can never be writing and flushing at the same time (that'd
mean we were flushing halfway through a message, which would be pointless)
so combine it with flush_pending too, calling the result output_pending.

Also assert that it takes the expected value whenever we change it,
and document the locking discipline used for it, including a subtle
case in write_message_in_idle_cb where it's not obvious at first glance
why we don't need the lock.

(Having the combined boolean at the top of the block of write-related
struct members improves struct packing on 64-bit platforms, by packing
read_num_ancillary_messages and output_pending into one word.)

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
12 years agoDisable two GDBus tests
Ryan Lortie [Fri, 16 Sep 2011 15:06:50 +0000 (11:06 -0400)]
Disable two GDBus tests

These tests try to use GMainContext across fork() which now fails a lot
more violently than it used to.

See https://bugzilla.gnome.org/show_bug.cgi?id=658999 for information.

12 years agoRevert "Add g_memory_input_stream_new_from_data_full/add_data_full() apis"
Murray Cumming [Fri, 16 Sep 2011 14:09:56 +0000 (16:09 +0200)]
Revert "Add g_memory_input_stream_new_from_data_full/add_data_full() apis"

I'm not sure that this API is right now that I try to use it.

This reverts commit 42738469d15585791bd5613356c47bcc2c413c20.

12 years agoAdd g_memory_input_stream_new_from_data_full/add_data_full() apis
Tristan Van Berkom [Fri, 16 Sep 2011 11:46:01 +0000 (13:46 +0200)]
Add g_memory_input_stream_new_from_data_full/add_data_full() apis

Add an extra state pointer and an extra GDestroyNotify function
to the 'Chunk' definition... allowing bindings to attach some extra
state to memory chunks (to get memory management correctly from
language bindings).
Bug #589887

12 years agoFix docs
Behdad Esfahbod [Thu, 15 Sep 2011 20:51:22 +0000 (16:51 -0400)]
Fix docs

12 years agoGApplication: don't create a mainloop
Ryan Lortie [Wed, 14 Sep 2011 01:57:30 +0000 (21:57 -0400)]
GApplication: don't create a mainloop

Just iterate the main context directly.  Also: avoid calling the virtual
functions for mainloops.

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

12 years agoGApplication test: fix testcase to avoid fork()
Ryan Lortie [Wed, 14 Sep 2011 15:06:02 +0000 (11:06 -0400)]
GApplication test: fix testcase to avoid fork()

The GApplication test case tried to fork() while using GMainLoop,
causing problems.  Avoid doing that by splitting the child process into
a separate program and spawning it in the usual way.

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

12 years agomainloop: detect fork() and abort
Ryan Lortie [Tue, 13 Sep 2011 23:56:22 +0000 (19:56 -0400)]
mainloop: detect fork() and abort

Abort if the child process returns to the mainloop after a fork().

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

12 years agoGApplication: add chain-up checks
Ryan Lortie [Wed, 14 Sep 2011 18:00:08 +0000 (14:00 -0400)]
GApplication: add chain-up checks

Make sure ::startup and ::shutdown are being chained up.

12 years agoGApplication: introduce ::shutdown
Brian Koning [Wed, 14 Sep 2011 17:42:35 +0000 (13:42 -0400)]
GApplication: introduce ::shutdown

Introduce ::shutdown as a dual to ::startup.

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

12 years agoUpdated Russian translation
Yuri Myasoedov [Wed, 14 Sep 2011 17:26:49 +0000 (21:26 +0400)]
Updated Russian translation

12 years agogdbus-codegen: Fix segfault when remote property is invalidated
Tomas Bzatek [Wed, 14 Sep 2011 17:02:01 +0000 (19:02 +0200)]
gdbus-codegen: Fix segfault when remote property is invalidated

The 'key' variable is no longer valid outside the cycle, owned and
probably already freed by GVariant. This causes apps to segfault
when proxy is constructed and a property on remote d-bus service
changes (actually is invalidated). Looks like a typo anyway.

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

12 years agoUpdated Brazilian Portuguese translation.
Og B. Maciel [Wed, 14 Sep 2011 13:14:02 +0000 (09:14 -0400)]
Updated Brazilian Portuguese translation.

12 years agoFix the description for g_app_info_get_icon()
Richard Hughes [Tue, 13 Sep 2011 15:38:40 +0000 (16:38 +0100)]
Fix the description for g_app_info_get_icon()

It can return NULL when there is no default icon.

12 years agoUpdated Tamil Translations
I Felix [Tue, 13 Sep 2011 10:10:27 +0000 (15:40 +0530)]
Updated Tamil Translations

12 years agoUpdated Tamil Translations
I Felix [Tue, 13 Sep 2011 10:04:22 +0000 (15:34 +0530)]
Updated Tamil Translations

12 years agoMerge remote-tracking branch 'gvdb/master'
Ryan Lortie [Mon, 12 Sep 2011 12:12:57 +0000 (08:12 -0400)]
Merge remote-tracking branch 'gvdb/master'

12 years agohashing: always use signed chars
Ryan Lortie [Mon, 12 Sep 2011 12:06:13 +0000 (08:06 -0400)]
hashing: always use signed chars

Our hashing of non-ASCII strings was undefined due to the fact that
'char' is signed on some platforms, unsigned on others.  Always use a
signed char.

Discovered by Alexander Larsson.

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

12 years agoGDesktopAppInfo: Improve docs
Matthias Clasen [Mon, 12 Sep 2011 05:56:45 +0000 (01:56 -0400)]
GDesktopAppInfo: Improve docs

12 years agoFix formatting in a doc comment
Matthias Clasen [Mon, 12 Sep 2011 05:49:01 +0000 (01:49 -0400)]
Fix formatting in a doc comment

12 years agoExpand mimeapps test
Matthias Clasen [Mon, 12 Sep 2011 05:46:48 +0000 (01:46 -0400)]
Expand mimeapps test

This adds a test involving both defaults.list and mimeapps.list.

12 years agoAlso check api results
Matthias Clasen [Mon, 12 Sep 2011 03:39:29 +0000 (23:39 -0400)]
Also check api results

In addition to looking at mimeapps.list, check that the default
and recommended apps returned by g_app_info api are as expected.

12 years agoRevert "Fix default setting generation in g_desktop_app_info_set_as_last_used"
Matthias Clasen [Mon, 12 Sep 2011 03:28:06 +0000 (23:28 -0400)]
Revert "Fix default setting generation in g_desktop_app_info_set_as_last_used"

This reverts commit a13f5ca4da05c3a7edaed9a70c508f63772897cb.

12 years agoAdapt tests to string changes
Matthias Clasen [Mon, 12 Sep 2011 03:25:20 +0000 (23:25 -0400)]
Adapt tests to string changes

12 years agoGType tutorial: clarify class struct initialisation
Ryan Lortie [Sun, 11 Sep 2011 19:44:39 +0000 (15:44 -0400)]
GType tutorial: clarify class struct initialisation

Make the information on how the class structure is initialised less
confusing to first-time readers.

12 years agoCosmetics
Matthias Clasen [Sun, 11 Sep 2011 17:08:14 +0000 (13:08 -0400)]
Cosmetics

Make configure --help output a little more regular, by using
AC_HELP_STRING() more consistently.

12 years agoUpdated Spanish translation
Jorge González [Sun, 11 Sep 2011 09:05:50 +0000 (11:05 +0200)]
Updated Spanish translation

12 years agoGKeyFile: Unify error messsages a bit
Matthias Clasen [Sat, 10 Sep 2011 20:09:39 +0000 (16:09 -0400)]
GKeyFile: Unify error messsages a bit

This marks a few forgotten error messages for translation, and
makes some other strings more uniform. String change!

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

12 years agoglib-compile-schemas: Pedantic string fixes
Matthias Clasen [Sat, 10 Sep 2011 14:36:00 +0000 (10:36 -0400)]
glib-compile-schemas: Pedantic string fixes

Replace 'can not' by 'cannot' in several places. String change!

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

12 years agoUpdated Hungarian translation
Gabor Kelemen [Sat, 10 Sep 2011 12:39:43 +0000 (14:39 +0200)]
Updated Hungarian translation

12 years agoFix default setting generation in g_desktop_app_info_set_as_last_used
Josselin Mouette [Sat, 10 Sep 2011 06:26:12 +0000 (08:26 +0200)]
Fix default setting generation in g_desktop_app_info_set_as_last_used

 * Do not ignore the system default
 * Do not exclude the last used being set from the default list

This fixes the default applications dialog in control-center.

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

12 years agoAdd some tests for mimeapps.list handling
Matthias Clasen [Sat, 10 Sep 2011 03:43:02 +0000 (23:43 -0400)]
Add some tests for mimeapps.list handling

These tests directly look at mimeapps.list to verify that
we make the expected changes to the database.

12 years agoAvoid some compiler warnings
Matthias Clasen [Sat, 10 Sep 2011 03:42:47 +0000 (23:42 -0400)]
Avoid some compiler warnings

12 years agoNix inaccurately named g_main_context_init_pipe()
Ryan Lortie [Sat, 10 Sep 2011 02:33:33 +0000 (22:33 -0400)]
Nix inaccurately named g_main_context_init_pipe()

...and fold its contents into g_main_context_new()

12 years agogmain: get rid of poll_waiting
Ryan Lortie [Sat, 10 Sep 2011 01:40:05 +0000 (21:40 -0400)]
gmain: get rid of poll_waiting

This variable, which is the cause of much grief, exists for two reasons:

  - ensuring the the wakeup pipe doesn't fill up

  - preventing the first poll() after adding a source from waking up
    immediately

The first point is no longer an issue with GWakeup.

The second point is addressed by using different logic: we only signal a
wakeup in the case that the context is currently acquired by a thread
that is not us.

As an added bonus, we can now implement g_main_context_wakeup() without
taking a lock.

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

12 years agoAdd macros for GSourceFunc return values
Emmanuele Bassi [Tue, 5 Oct 2010 13:01:05 +0000 (14:01 +0100)]
Add macros for GSourceFunc return values

The boolean values to be returned by a GSourceFunc are always ambiguous,
and even in case of experienced developers then can lead to confusion.

The Perl bindings for GLib have two simple constants, mapping to TRUE
and FALSE, that make the return values less confusing: G_SOURCE_CONTINUE
and G_SOURCE_REMOVE respectively.

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

12 years agoKeep up with the standards
Matthias Clasen [Sat, 10 Sep 2011 00:35:01 +0000 (20:35 -0400)]
Keep up with the standards

More choices, always better.

12 years agoGRegex: fix thread-unsafe initialiser code
Ryan Lortie [Fri, 9 Sep 2011 23:54:06 +0000 (19:54 -0400)]
GRegex: fix thread-unsafe initialiser code

12 years agoClean up l10n threading stuff
Ryan Lortie [Fri, 9 Sep 2011 23:48:14 +0000 (19:48 -0400)]
Clean up l10n threading stuff

Remove the explicit thread initialisation functions for g_get_charset(),
g_get_filename_charsets() and g_get_language_names().

Add a lock around one remaining case of access to libcharset (the other
2 cases already have the lock).

Do a proper g_once_init_enter() style initialisation for the GLib
gettext functions.

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

12 years agoglib-private: #include <glib.h>
Ryan Lortie [Fri, 9 Sep 2011 20:05:55 +0000 (16:05 -0400)]
glib-private: #include <glib.h>

This is really our only choice if we don't want to annoy the
single-include checking when we use this from inside of gio.

12 years agoDrop long-removed atomic thread init from header
Ryan Lortie [Fri, 9 Sep 2011 19:47:01 +0000 (15:47 -0400)]
Drop long-removed atomic thread init from header

12 years agoRemove now-useless glibprivate.h
Ryan Lortie [Fri, 9 Sep 2011 19:21:07 +0000 (15:21 -0400)]
Remove now-useless glibprivate.h

The only symbol in glibprivate.h was moved to glib-private.h.

12 years agoglib worker: move to glib-private framework
Ryan Lortie [Fri, 9 Sep 2011 18:30:25 +0000 (14:30 -0400)]
glib worker: move to glib-private framework

Remove the private glib_get_worker_context() symbol and move it over to
using the glib-private stuff like GWakeup is doing.

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

12 years agogwakeup.h: add missing header for GPollFD
Ryan Lortie [Fri, 9 Sep 2011 18:30:01 +0000 (14:30 -0400)]
gwakeup.h: add missing header for GPollFD

12 years agoAdd glib__private__() API to share between glib,gio; port GWakeup to it
Colin Walters [Thu, 1 Sep 2011 18:32:11 +0000 (14:32 -0400)]
Add glib__private__() API to share between glib,gio; port GWakeup to it

Historically we've added random symbols to the public API with warnings
that they're private; examples are:

glib_gettext(), glib_pgettext()
g_thread_functions_for_glib_use, g_thread_use_default_impl, etc.

And we almost added "GWakeup" to public API just to share between glib and
gio.

This new glib__private__() API exports a hidden vtable, and adds a macro
GLIB_PRIVATE_CALL() that makes it generally convenient to use.

This adds an extremely tiny cost for the double indirection; but it has
the benefit that we don't need to either:

1) compile the code into both glib and gio (like GWakeup), with the
   inefficiency that implies.
2) Export a "do not use this" symbol; the serious problem with this is
   that someone CAN use it pretty easily.  Particularly if we document
   it.  It's far, far harder to peek into a structure without a public
   header file.

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

12 years agoGMainLoop: remove wall clock time cache
Ryan Lortie [Tue, 30 Aug 2011 17:32:58 +0000 (13:32 -0400)]
GMainLoop: remove wall clock time cache

Since GMainLoop is now purely monotonic, it really doesn't make sense to
cache the wallclock time just for the sake of making a deprecated call
more efficient.

12 years agogtester: Remove SIGCHLD race workarounds
Ryan Lortie [Thu, 1 Sep 2011 03:02:03 +0000 (23:02 -0400)]
gtester: Remove SIGCHLD race workarounds

With the GMainLoop changes, gtester should now be race-free.

12 years agoModify child and signal sources to use worker
Ryan Lortie [Thu, 1 Sep 2011 02:58:26 +0000 (22:58 -0400)]
Modify child and signal sources to use worker

12 years agoGMain: simplify logic for g_wakeup_acknowledge()
Ryan Lortie [Thu, 1 Sep 2011 02:07:02 +0000 (22:07 -0400)]
GMain: simplify logic for g_wakeup_acknowledge()

Instead of messing around with context->poll_waiting, just look at the
GPollFD to see if the GWakeup needs to be acknowledged.

12 years agoGMainLoop: remove single-threaded case
Ryan Lortie [Wed, 31 Aug 2011 22:33:32 +0000 (18:33 -0400)]
GMainLoop: remove single-threaded case

Since we now always have thread support in libglib, we can remove the
buggy single-threaded codepath for GMainContext.

12 years agoAdd private glib_get_worker_context() API
Ryan Lortie [Wed, 31 Aug 2011 22:20:24 +0000 (18:20 -0400)]
Add private glib_get_worker_context() API

The first time this is called, this creates a GMainContext * and a
thread to run it.  Future calls return the same.  There are a lot of
places that we could use this in GLib.

12 years agoGRand: Make sure to g_thread_init_glib()
Ryan Lortie [Fri, 9 Sep 2011 17:39:22 +0000 (13:39 -0400)]
GRand: Make sure to g_thread_init_glib()

The last commit should g_thread_init_glib() before attempting to use
GOnce.

12 years agoGRand: remove setup from g_thread_init_glib
Ryan Lortie [Fri, 9 Sep 2011 17:31:21 +0000 (13:31 -0400)]
GRand: remove setup from g_thread_init_glib

Use g_once_init_enter instead.

12 years agoemufutex: remove init from g_thread_init_glib
Ryan Lortie [Fri, 9 Sep 2011 17:20:40 +0000 (13:20 -0400)]
emufutex: remove init from g_thread_init_glib

Use a GStaticMutex instead.

12 years agowin32: remove version init from g_thread_init_glib
Ryan Lortie [Fri, 9 Sep 2011 17:15:17 +0000 (13:15 -0400)]
win32: remove version init from g_thread_init_glib

Instead, make this use g_once_init_enter() in the usual way.

12 years agomake g_thread_init_glib() idempotent
Ryan Lortie [Wed, 31 Aug 2011 22:07:55 +0000 (18:07 -0400)]
make g_thread_init_glib() idempotent

12 years agoMove the GThread implementations to glib/
Ryan Lortie [Wed, 31 Aug 2011 22:00:03 +0000 (18:00 -0400)]
Move the GThread implementations to glib/

We can now get threads initialised from inside of libglib by calling
g_thread_init_glib().

12 years agoinvert gthread-impl includes
Ryan Lortie [Wed, 31 Aug 2011 21:40:01 +0000 (17:40 -0400)]
invert gthread-impl includes

configure.ac defined G_THREAD_SOURCE and gthread-impl would #include it.

Instead, since we only have two thread implementations now, and since we
always use the Windows one only on Windows, move the logic to the
Makefile, predicated on 'if OS_WIN32'.  Then have the chosen backend do
the #include "gthread-impl.c" from there.

Remove the G_THREAD_SOURCE define from configure.ac.

12 years agowin32 threads: assume TryEnterCriticalSection
Ryan Lortie [Wed, 31 Aug 2011 21:18:43 +0000 (17:18 -0400)]
win32 threads: assume TryEnterCriticalSection

Remove the dynamic lookup for TryEnterCriticalSection, which has existed
since Windows 2000.

12 years agoStop using HAVE_G_THREAD_IMPL_INIT
Ryan Lortie [Wed, 31 Aug 2011 21:02:21 +0000 (17:02 -0400)]
Stop using HAVE_G_THREAD_IMPL_INIT

Just always call the init function.

12 years agoMove thread priority translation into the backends
Ryan Lortie [Wed, 31 Aug 2011 20:30:04 +0000 (16:30 -0400)]
Move thread priority translation into the backends

The translation of GLib priorities into the thread priorities of
different operating systems belongs in the implementation -- not
half-way in the front end.

12 years agoRemove useless macros from when we supported DCE
Ryan Lortie [Wed, 31 Aug 2011 20:46:32 +0000 (16:46 -0400)]
Remove useless macros from when we supported DCE

These are non-ops now, and easily replaced.

12 years agoRemove support for DCE threads
Ryan Lortie [Wed, 31 Aug 2011 20:41:24 +0000 (16:41 -0400)]
Remove support for DCE threads

12 years agoRemove support for custom thread implementations
Ryan Lortie [Wed, 31 Aug 2011 20:10:55 +0000 (16:10 -0400)]
Remove support for custom thread implementations

12 years agoRemove the dead 'none' thread implementation
Ryan Lortie [Wed, 31 Aug 2011 20:03:22 +0000 (16:03 -0400)]
Remove the dead 'none' thread implementation

12 years agoGThread: remove errorcheck mutex support
Ryan Lortie [Wed, 31 Aug 2011 20:01:09 +0000 (16:01 -0400)]
GThread: remove errorcheck mutex support

This can only possibly work if we call g_thread_init(), which we are
moving away from.

12 years agogthread: remove some unused forward declarations
Ryan Lortie [Wed, 31 Aug 2011 19:53:36 +0000 (15:53 -0400)]
gthread: remove some unused forward declarations

12 years agoDeprecated (undocumented) g_thread_gettime
Ryan Lortie [Wed, 31 Aug 2011 19:49:35 +0000 (15:49 -0400)]
Deprecated (undocumented) g_thread_gettime

g_thread_gettime() is an undocumented public function pointer that
points to a function that returns the monotonic time in nanoseconds.
g_get_monotonic_time() does the same in microseconds, so it can be used
instead.

GLib had one internal user in GFileMonitor that only cared about
millisecond accuracy; it has been ported to g_get_monotonic_time().

12 years agoUpdate building docs to mention mandatory threads
Ryan Lortie [Wed, 31 Aug 2011 20:43:15 +0000 (16:43 -0400)]
Update building docs to mention mandatory threads

The docs used to say thread support was optional -- it's mandatory now.