Ryan Lortie [Sat, 15 Oct 2011 15:03:07 +0000 (11:03 -0400)]
tests/Makefile.am: remove unused LDFLAGS variable
Matthias Clasen [Sat, 15 Oct 2011 17:04:20 +0000 (13:04 -0400)]
Expand thread docs a bit
Add some discussion of pitfalls of threaded programming.
Matthias Clasen [Sat, 15 Oct 2011 15:37:03 +0000 (11:37 -0400)]
Documentation tweaks
Fran Dieguez [Sat, 15 Oct 2011 14:29:50 +0000 (16:29 +0200)]
Updaged Galician translations
Ryan Lortie [Sat, 15 Oct 2011 13:48:42 +0000 (09:48 -0400)]
Check for "our" threads in some places
Don't allow g_thread_join() to be called on or g_thread_exit() to be
called from within threads that were not created by GLib. Document
this.
Ryan Lortie [Sat, 15 Oct 2011 13:48:22 +0000 (09:48 -0400)]
gtk-doc g_thread_ref() and g_thread_unref()
Ryan Lortie [Sat, 15 Oct 2011 13:48:10 +0000 (09:48 -0400)]
Rename g_thread_try to g_thread_try_new
Matthias Clasen [Sat, 15 Oct 2011 04:56:08 +0000 (00:56 -0400)]
Add atomic test to TEST_PROGS
Matthias Clasen [Sat, 15 Oct 2011 04:26:02 +0000 (00:26 -0400)]
Documentation additions
Matthias Clasen [Sat, 15 Oct 2011 04:09:20 +0000 (00:09 -0400)]
Improve test coverage
Matthias Clasen [Sat, 15 Oct 2011 03:20:06 +0000 (23:20 -0400)]
Add a test involving g_thread_ref/unref
Also, fix the resource-limit test to properly unset RLIMIT_NPROC.
Matthias Clasen [Sat, 15 Oct 2011 03:12:06 +0000 (23:12 -0400)]
Add g_thread_try to the docs
Matthias Clasen [Sat, 15 Oct 2011 03:01:05 +0000 (23:01 -0400)]
Update doc lists
Matthias Clasen [Sat, 15 Oct 2011 03:00:17 +0000 (23:00 -0400)]
Minor doc clarifications
Ryan Lortie [Sat, 15 Oct 2011 01:52:36 +0000 (21:52 -0400)]
Mention thread API changes in README
Ryan Lortie [Sat, 15 Oct 2011 01:43:51 +0000 (21:43 -0400)]
I read the news today, oh boy...
Ryan Lortie [Fri, 14 Oct 2011 23:41:08 +0000 (19:41 -0400)]
Stop checking for fork() across GMainContext
01ed78d525cf2f8769022e27cc2573ec7ba123b3 introduced assertion checks for
creating a main context, forking, and attempting to use the main context
from the child side of the fork.
Some code (such as gnome-keyring-daemon) daemonise after calling
GMainContext. That's probably still mostly safe since we still only
have one side of the fork touching the context afterwards.
This use case is still troubling, however, since if any worker threads
have been created at the time of the fork(), we could end up in the
classic situation of leaving some mutexes in a locked state when the
other threads disappear from the copy of the image that the child gets.
This will require some deeper thinking...
Ryan Lortie [Fri, 14 Oct 2011 17:02:58 +0000 (13:02 -0400)]
Mask all signals in GLib worker thread
Some code using GLib (gnome-keyring-daemon, for example) assumes that
they can catch signals by masking them out in the main thread and
calling sigwait() from a worker.
The problem is that our new worker thread catches the signals before
sigwait() has a chance and the default action occurs (typically
resulting in program termination).
If we mask all the signals in our worker, then this can't happen.
Florian Müllner [Thu, 13 Oct 2011 20:33:21 +0000 (22:33 +0200)]
desktop-app-info: Add support for X-GNOME-Keywords
With search gaining traction as being the preferred way to locate
applications, the existing .desktop file fields meant for browsing
often produce insufficient results.
gnome-control-center introduced a custom X-GNOME-Keywords field for
that purpose, which we plan to support in gnome-shell as well.
https://bugzilla.gnome.org/show_bug.cgi?id=661763
Ryan Lortie [Fri, 14 Oct 2011 04:00:14 +0000 (00:00 -0400)]
g_cond_timed_wait: support NULL time parameter
It was undocumented, but this used to mean "wait forever". Looks like
we have some uses of this internally and there may be others in the
wild...
Ryan Lortie [Fri, 14 Oct 2011 03:24:23 +0000 (23:24 -0400)]
GCond: use monotonic time for timed waits
Switch GCond to using monotonic time for timed waits by introducing a
new API based on monotonic time in a gint64: g_cond_wait_until().
Deprecate the old API based on wallclock time in a GTimeVal.
Fix up the gtk-doc for GCond while we're at it: update the examples to
use static-allocated GCond and GMutex and clarify some things a bit.
Also explain the rationale behind using an absolute time instead of a
relative time.
Ryan Lortie [Thu, 13 Oct 2011 14:51:35 +0000 (10:51 -0400)]
tests: disable deprecation warnings for tests
We need to test deprecated functions, so don't warn us for doing so.
Ryan Lortie [Thu, 13 Oct 2011 13:14:57 +0000 (09:14 -0400)]
gutils: stop using GStaticPrivate
This was our last internal use.
Ryan Lortie [Thu, 13 Oct 2011 13:00:54 +0000 (09:00 -0400)]
Revert "make struct _GThread private"
This reverts commit
d904612100120d12126f1a6623a106d8a5b02fa6.
glibmm touches the contents of GThread, so this broke their build.
Ryan Lortie [Thu, 13 Oct 2011 05:24:16 +0000 (01:24 -0400)]
make struct _GThread private
Hide the definition of struct _GThread in gthreadprivate.h for now.
This is possibly an API break -- although the structure contents were
undocumented and it was not safe to access them in a meaningful way,
someone may have tried to do it anyway. We'll leave it here for a while
to see if it causes any problems.
Avoid merging its contents with GRealThread for now, just incase we need
to expose it again.
Ryan Lortie [Thu, 13 Oct 2011 05:22:51 +0000 (01:22 -0400)]
tidy up gthreadprivate.h
Remove some unused includes, too.
Ryan Lortie [Thu, 13 Oct 2011 05:17:36 +0000 (01:17 -0400)]
drop g_thread_new_full()
We'll hold out on this until someone has a really convincing reason for
why they need to control the stack size.
If we do decide to add it back, it should probably have a name like
_new_with_stack_size(), not _full().
Ryan Lortie [Thu, 13 Oct 2011 05:00:57 +0000 (01:00 -0400)]
g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
Ryan Lortie [Thu, 13 Oct 2011 04:43:33 +0000 (00:43 -0400)]
thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().
Change the wording in the docs. Clarify expectations for
(deprecated) g_thread_create().
Ryan Lortie [Thu, 13 Oct 2011 04:29:04 +0000 (00:29 -0400)]
GThread: make refcounting public
Ryan Lortie [Thu, 13 Oct 2011 04:18:17 +0000 (00:18 -0400)]
thread: simplify 'free' process
GThread is freed using some very slightly confusing logic: if the thread
was created 'joinable', then the structure is freed after the join()
call succeeds (since we know the thread has exited). If the thread was
not created 'joinable' then the free is when the thread quits (since we
know 'join' will not be called later).
Move to a straight ref-counting system: 1 ref owned by the thread and 1
extra ref if the thread is joinable. Both thread quit and joining will
decrease the refcount by 1.
Ryan Lortie [Thu, 13 Oct 2011 04:01:28 +0000 (00:01 -0400)]
remove 'joinable' parameter to backends
Both backends are now oblivious to the concept of joinability, so don't
bother passing the parameter.
Ryan Lortie [Thu, 13 Oct 2011 03:40:02 +0000 (23:40 -0400)]
posix threads: joinable tweaks
Make the POSIX backend a little bit more like the win32 one in terms of
how we deal with joinability.
Calling g_system_thread_join() is now optional, and
g_system_thread_wait() can be safely called by multiple threads.
There is no longer any internal concept of joinability.
Ryan Lortie [Thu, 13 Oct 2011 03:25:12 +0000 (23:25 -0400)]
tests: don't #include <sys/resource.h> on win32
Ryan Lortie [Thu, 13 Oct 2011 03:22:31 +0000 (23:22 -0400)]
win32 threads: simplify
Merge the GThreadData with the GThreadWin32 struct. Drop the extra TLS
variable.
Close the handle on _free(), which means that there is no leak if
g_system_thread_join() isn't called.
Remove all internal concept of joinability.
Ryan Lortie [Thu, 13 Oct 2011 03:16:49 +0000 (23:16 -0400)]
Only g_system_thread_free() our own threads
Keep track of if we created a thread for ourselves or if the GThread*
was allocated in response to g_thread_self() on a previously-unknown
thread.
Only call g_system_thread_free() in the first case.
Ryan Lortie [Thu, 13 Oct 2011 03:04:15 +0000 (23:04 -0400)]
Finish killing off GSystemThread
Ryan Lortie [Thu, 13 Oct 2011 02:53:52 +0000 (22:53 -0400)]
win32 threads: use our own data, not system_thread
Stop using the generic system_thread field in GRealThread. Use our own
pointer instead.
Ryan Lortie [Thu, 13 Oct 2011 02:49:39 +0000 (22:49 -0400)]
win32: fix function name clash
Ryan Lortie [Thu, 13 Oct 2011 02:40:37 +0000 (22:40 -0400)]
posix threads: use our own system_thread
Wrap GRealThread in a GThreadPosix that includes its own pthread_t field
called "system_thread" and use that instead of the generic field in
GRealThread.
Ryan Lortie [Thu, 13 Oct 2011 02:35:35 +0000 (22:35 -0400)]
thread creation: Simplify error handling
Instead of always returning non-NULL and finding out about errors via
the GError*, return NULL from the backend in the event of an error.
Ryan Lortie [Thu, 13 Oct 2011 02:29:13 +0000 (22:29 -0400)]
Combine g_sytem_thread_{new,create}()
Ryan Lortie [Thu, 13 Oct 2011 02:23:12 +0000 (22:23 -0400)]
g_system_thread_create: drop 'data' arg
Since it's now always the same as the 'thread' arg.
Ryan Lortie [Thu, 13 Oct 2011 02:19:28 +0000 (22:19 -0400)]
g_system_thread_create: SystemThread -> RealThread
Just like g_system_thread_wait().
Matthias Clasen [Thu, 13 Oct 2011 02:29:18 +0000 (22:29 -0400)]
Move more docs inline
Ryan Lortie [Thu, 13 Oct 2011 02:15:46 +0000 (22:15 -0400)]
g_system_thread_join: rename to _wait()
Ryan Lortie [Thu, 13 Oct 2011 02:14:38 +0000 (22:14 -0400)]
g_system_thread_join: take GRealThread *
Make g_system_thread_join take the GRealThread* instead of a
GSystemThread.
Ryan Lortie [Thu, 13 Oct 2011 02:03:14 +0000 (22:03 -0400)]
thread: delegate allocation of GThread to backends
Add g_system_thread_new() and g_system_thread_free(), implemented with
GSlice. Use those instead of g_new() and g_free().
Presently, the backends are both doing the same thing. This will change
soon.
Matthias Clasen [Thu, 13 Oct 2011 01:48:34 +0000 (21:48 -0400)]
Move GScanner docs inline
Ryan Lortie [Thu, 13 Oct 2011 01:47:25 +0000 (21:47 -0400)]
thread: stop sharing g_once_mutex
Unrelated code shouldn't be sharing the same mutex for no good reason --
particularly not across a file boundary.
Ryan Lortie [Thu, 13 Oct 2011 01:44:07 +0000 (21:44 -0400)]
thread: drop thread setup function hackery
Use a custom proxy function for the deprecated case instead.
Now GRealThread has strictly zero members dedicated to deprecated
functionality.
Matthias Clasen [Wed, 12 Oct 2011 23:55:02 +0000 (19:55 -0400)]
Deprecate GCache
Ryan said it would be 'deprecated soon in GLib', when he removed
the use of this in GTK+. That was a year ago, so its about time
we act on it.
Ryan Lortie [Wed, 12 Oct 2011 22:35:45 +0000 (18:35 -0400)]
thread: Delete g_system_thread_self()
It's no longer used for anything at all.
Ryan Lortie [Wed, 12 Oct 2011 22:33:07 +0000 (18:33 -0400)]
thread: reduce use of system_thread
The use of system_thread is now limited to joining. We don't do that
for threads that we didn't create for ourselves, so we don't need to
call g_system_thread_self() to fill in system_thread for those.
Ryan Lortie [Wed, 12 Oct 2011 22:27:06 +0000 (18:27 -0400)]
thread: hide g_static_rec_mutex_get_rec_mutex_impl
Unlike with GStaticMutex, this function was never part of the pre-2.32
ABI, so we should keep it tucked in.
Ryan Lortie [Wed, 12 Oct 2011 22:25:40 +0000 (18:25 -0400)]
missed from last commit
Ryan Lortie [Wed, 12 Oct 2011 22:24:48 +0000 (18:24 -0400)]
thread: remove GSystemThread assign/equal
These are no longer in use.
Ryan Lortie [Wed, 12 Oct 2011 22:23:20 +0000 (18:23 -0400)]
thread: remove dead decl from gthreadprivate.h
This function hasn't existed for a while...
Ryan Lortie [Wed, 12 Oct 2011 22:22:31 +0000 (18:22 -0400)]
thread: Remove the zero_thread
This was only used for redundant assertion checks.
Ryan Lortie [Tue, 11 Oct 2011 15:08:48 +0000 (11:08 -0400)]
GStaticRecMutex: implement via GRecMutex
Instead of doing our own hacked-up version.
This also reduces use of GSystemThread.
Ryan Lortie [Wed, 12 Oct 2011 21:01:33 +0000 (17:01 -0400)]
thread: use GSList for g_thread_foreach list
...instead of having a 'next' pointer in the GThread struct.
Now GThread contains no fields used only by deprecated code (except for
the rather generic setup function field).
Ryan Lortie [Wed, 12 Oct 2011 20:50:43 +0000 (16:50 -0400)]
thread: call g_enumerable_thread_add via callback
There are no longer any functions defined in gthread-deprecated.c called
from gthread.c.
Ryan Lortie [Wed, 12 Oct 2011 20:26:39 +0000 (16:26 -0400)]
thread: use GPrivate for enumerable threads
Use a GPrivate to track the destruction of enumerable threads and remove
them from the list.
Colin Walters [Wed, 12 Oct 2011 19:25:12 +0000 (15:25 -0400)]
gvariant: Doc typo fix
Colin Walters [Wed, 12 Oct 2011 19:22:09 +0000 (15:22 -0400)]
gvariant: Briefly mention limits
Dan Winship [Wed, 12 Oct 2011 17:59:33 +0000 (13:59 -0400)]
gthread-deprecated: add a mising "static" to a method
Dan Winship [Wed, 12 Oct 2011 17:57:44 +0000 (13:57 -0400)]
giomodule: make the default_modules mutex recursive
It is possible for _g_io_module_get_default() to be called recursively
(eg, if a module of one type is loaded that tries to look up gsettings
from its init() method and ends up causing the gsettings module to be
loaded). So use a recursive mutex.
Dan Winship [Tue, 11 Oct 2011 19:38:37 +0000 (15:38 -0400)]
Simplify checks for CLOCK_MONOTONIC
Remove the complicated configure-time and runtime checks, and just use
CLOCK_MONOTONIC if it's defined.
https://bugzilla.gnome.org/show_bug.cgi?id=661421
Matthias Clasen [Wed, 12 Oct 2011 04:37:02 +0000 (00:37 -0400)]
Disable deprecations where appropriate in tests
Matthias Clasen [Wed, 12 Oct 2011 04:37:02 +0000 (00:37 -0400)]
Disable deprecations where appropriate in tests
Matthias Clasen [Wed, 12 Oct 2011 04:24:46 +0000 (00:24 -0400)]
Make single includes mandatory
This has been the official line since 2.17, which seems plenty
long enough for a transition phase.
Ryan Lortie [Wed, 12 Oct 2011 03:13:22 +0000 (23:13 -0400)]
GStaticPrivate: implement via GPrivate
Thanks to the modifications in
3d4846d92309d001697c2827660fa41b5c63dbc4,
GStaticPrivate is not so directly tied in with GThread anymore. It is
now a simple matter to cut it out completely by using a GPrivate to
store the GArray instead of storing it in the GThread.
Matthias Clasen [Wed, 12 Oct 2011 03:50:34 +0000 (23:50 -0400)]
Update deprecation docs
Matthias Clasen [Wed, 12 Oct 2011 03:44:43 +0000 (23:44 -0400)]
Silence deprecations in deprecated/ (again)
Chun-wei Fan [Wed, 12 Oct 2011 03:23:49 +0000 (11:23 +0800)]
Update VS projects
Get rid of _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS
from the preprocessor definitions as those two macros are now defined
in msvc_recommended_pragmas.h, which is force-included in these projects
via the property sheets. This will silence C4005 warnings on macro
redefinition.
Chun-wei Fan [Wed, 12 Oct 2011 02:53:30 +0000 (10:53 +0800)]
Bug 661438: Update msvc_recommended_pragmas.h
Don't disable warning C4996 as that is the Visual C++ warning triggered by
__declspec(deprecated) and __declspec(deprecated('..."))-disabling that
warning will defeat the purpose of G_DPRECATED/G_DEPRECATED_FOR.
For people who don't want to see the GLib deprecation warnings during GLib
compilation, define GLIB_DISABLE_DEPRECATION_WARNINGS in the projects or
property sheet.
Chun-wei Fan [Wed, 12 Oct 2011 02:38:47 +0000 (10:38 +0800)]
Bug 661438: Fix up gmacros.h a bit
The macro here should be G_DEPRECATED, not G_GNUC_DEPRECATED.
Chun-wei Fan [Wed, 12 Oct 2011 02:37:24 +0000 (10:37 +0800)]
Update VS property sheets
Missed the new glib/gstringchunk.h header that needed to be installed as
well.
Dan Winship [Tue, 11 Oct 2011 23:28:59 +0000 (19:28 -0400)]
g_time_val_from_iso8601: clarify the docs a bit
Ryan Lortie [Tue, 11 Oct 2011 22:39:57 +0000 (18:39 -0400)]
gmain: use GPrivate instead of GStaticPrivate
Dan Winship [Tue, 11 Oct 2011 19:36:42 +0000 (15:36 -0400)]
Fix two tests for G_DEBUG=gc-friendly
Chun-wei Fan [Tue, 11 Oct 2011 06:34:59 +0000 (14:34 +0800)]
Use GLIB_DEPRECATED instead of G_GNUC_DEPRECATED in our headers
This will let others opt out of seeing GLib deprecation warnings
by defining GLIB_DISABLE_DEPRECATION_WARNINGS.
https://bugzilla.gnome.org/show_bug.cgi?id=661438
Matthias Clasen [Tue, 11 Oct 2011 17:33:07 +0000 (13:33 -0400)]
Add our own deprecation macros
This will allow to suppress deprecation warnings on a per-module
basis, if needed. They are on by default now, though.
Matthias Clasen [Tue, 11 Oct 2011 17:06:58 +0000 (13:06 -0400)]
Add better deprecation macros
Unlike G_GNUC_... macros, the new G_DEPRECATED[_FOR] are
meant as abstractions that work with different compilers.
Using a new name also lets us restrict it to 'must be placed
before the declaration', which works with more compilers.
https://bugzilla.gnome.org/show_bug.cgi?id=661438
Chun-wei Fan [Tue, 11 Oct 2011 10:04:07 +0000 (18:04 +0800)]
Update VS property sheets
Copy the deprecated headers in their appropriate places.
Chun-wei Fan [Tue, 11 Oct 2011 06:19:02 +0000 (14:19 +0800)]
glibconfig.win32(.in): Cleanup cruft
The definitions of _GMutex* and G_STATIC_MUTEX_INIT is now found in
glib/deprecated/gthread.h, and should no longer be in the mainline
code, so remove them from here.
Ryan Lortie [Mon, 10 Oct 2011 17:13:31 +0000 (13:13 -0400)]
GStaticMutex: ABI fixup
Everything was OK as long as GMutex was backed by pthread_mutex_t on
POSIX. Since this is no longer the case, the ABI of GStaticMutex was
broken.
Fix that up by using pthread_mutex_t directly in the structure. Since
that's potentially incompatible with our GMutex implementation, set
g_thread_use_default_impl to FALSE to cause the fallback code (which
manually allocates a GMutex) to run, even in the case of
already-existing code (without the need for a recompile). This will
cause the pthread_mutex_t part of the struct to be completely ignored.
Matthias Clasen [Mon, 10 Oct 2011 15:10:20 +0000 (11:10 -0400)]
Compile private test with -pthread on UNIX
We are using explicit pthread calls here, so we should
use the right linker flags for that.
https://bugzilla.gnome.org/show_bug.cgi?id=661318
Matthias Clasen [Mon, 10 Oct 2011 13:49:50 +0000 (09:49 -0400)]
Don't use deprecated GThread API in gio tests
Kjartan Maraas [Mon, 10 Oct 2011 05:53:16 +0000 (07:53 +0200)]
Updated Norwegian bokmål translation
Algimantas Margevičius [Sun, 9 Oct 2011 19:00:49 +0000 (22:00 +0300)]
Updated Lithuanian translation
Matthias Clasen [Sun, 9 Oct 2011 13:57:13 +0000 (09:57 -0400)]
Silence deprecation warnings in deprecated/
We know we are all deprecated here...
Matthias Clasen [Sun, 9 Oct 2011 03:49:04 +0000 (23:49 -0400)]
Add G_GNUC_DEPRECATED to deprecated functions in gio
Matthias Clasen [Sun, 9 Oct 2011 03:23:43 +0000 (23:23 -0400)]
Add G_GNUC_DEPRECATED to deprecated functions in gobject
Matthias Clasen [Sun, 9 Oct 2011 03:16:01 +0000 (23:16 -0400)]
Add G_GNUC_DEPRECATED to deprecated APIs in glib
Matthias Clasen [Sat, 8 Oct 2011 16:43:12 +0000 (12:43 -0400)]
Add some GHookList tests
Matthias Clasen [Sat, 8 Oct 2011 16:42:41 +0000 (12:42 -0400)]
Test a few more GIOChannel functions
Matthias Clasen [Sat, 8 Oct 2011 16:42:06 +0000 (12:42 -0400)]
Remove a bit of dead code
Matthias Clasen [Sat, 8 Oct 2011 16:41:38 +0000 (12:41 -0400)]
Pass G_DEBUG=g-gc-friendly when running the tests
Matthias Clasen [Thu, 6 Oct 2011 13:01:24 +0000 (09:01 -0400)]
Add some more GMarkup tests