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
Matthias Clasen [Thu, 6 Oct 2011 12:59:51 +0000 (08:59 -0400)]
Call setlocale in markup-parse test
This is necessary to make utf-8 text come out properly.
Matthias Clasen [Thu, 6 Oct 2011 03:36:35 +0000 (23:36 -0400)]
Improve GNode test coverage
Matthias Clasen [Thu, 6 Oct 2011 03:31:14 +0000 (23:31 -0400)]
Improve GCache test coverage
Matthias Clasen [Thu, 6 Oct 2011 03:24:27 +0000 (23:24 -0400)]
Improve coverage of string function tests
Matthias Clasen [Thu, 6 Oct 2011 03:24:08 +0000 (23:24 -0400)]
Improve coverage of GHmac tests
Matthias Clasen [Thu, 6 Oct 2011 03:00:09 +0000 (23:00 -0400)]
Add a test for g_date_time_new_from_timeval_utc
Antoine Jacoutot [Sat, 8 Oct 2011 09:47:20 +0000 (11:47 +0200)]
gio: enable test_peer regression test for OpenBSD
https://bugzilla.gnome.org/show_bug.cgi?id=661255
David Zeuthen [Fri, 7 Oct 2011 18:20:03 +0000 (14:20 -0400)]
GDBusConnection: Make pending calls error when the connection is lost
If the connection to the bus is lost while a method call is ongoing,
the method call does not get cancelled. Instead it just sits around
until it times out.
This is visible here on XO laptops when stopping the display manager
during shutdown. imsettings starts sending a sync message to give up
its bus name (via g_bus_unown_name()), then systemd terminates the
session bus at approximately the same time. imsettings then hangs for
about 20 seconds before timing out the message.
http://lists.freedesktop.org/archives/dbus/2011-September/014717.html
imsettings behaviour could be improved as described in that thread,
but I think this is a glib bug. I've also come up with the attached
patch which fixes it.
Credits for the bug-fix goes to Daniel Drake <dsd@laptop.org>. The test
case was written by David Zeuthen <zeuthen@gmail.com>.
https://bugzilla.gnome.org/show_bug.cgi?id=660637
Signed-off-by: David Zeuthen <davidz@redhat.com>
John Ralls [Fri, 7 Oct 2011 16:51:04 +0000 (09:51 -0700)]
Bug 661129: Duplicate symbols zero_thread and g_once_mutex on OSX
Dan Winship [Wed, 5 Oct 2011 14:46:57 +0000 (10:46 -0400)]
Add g_main_context_ref_thread_default()
Add g_main_context_ref_thread_default(), which always returns a
reffed GMainContext, rather than sometimes returning a (non-reffed)
GMainContext, and sometimes returning NULL. This simplifies the
bookkeeping in any code that needs to keep a reference to the
thread-default context for a while.
https://bugzilla.gnome.org/show_bug.cgi?id=660994
Daniel Mustieles [Fri, 7 Oct 2011 08:14:10 +0000 (10:14 +0200)]
Updated Spanish translation
Matthias Clasen [Fri, 7 Oct 2011 05:19:15 +0000 (01:19 -0400)]
USE __COUNTER__ instead of __LINE__ when available
I've seen builds fail with
nm-connection.c:119:691: error: declaration of '_GStaticAssertCompileTimeAssertion_119' shadows a previous local [-Werror=shadow]
because several compile-time assertions ended up on the same
line. __COUNTER__ is meant specifically for the purpose of
constructing identifiers, so use it when available.
Matthias Clasen [Fri, 7 Oct 2011 04:42:52 +0000 (00:42 -0400)]
Don't redundantly redeclare
It makes gcc throw an error:
redundant redeclaration of 'g_static_mutex_get_mutex_impl' [-Werror=redundant-decls]
Ryan Lortie [Thu, 6 Oct 2011 16:24:21 +0000 (12:24 -0400)]
Move G_LOCK below GMutex in the docs
The flow is currently a bit wrong since G_LOCK makes reference to GMutex
which was not yet defined, so switch things around.
Ryan Lortie [Thu, 6 Oct 2011 16:21:33 +0000 (12:21 -0400)]
.gitignore
Ryan Lortie [Thu, 6 Oct 2011 16:19:58 +0000 (12:19 -0400)]
Several docs cleanups
Ryan Lortie [Thu, 6 Oct 2011 16:01:53 +0000 (12:01 -0400)]
Cleanup thread documentation
Chun-wei Fan [Thu, 6 Oct 2011 08:02:18 +0000 (16:02 +0800)]
gobjet/gclosure.c: Fix styling issues
...so that it looks more consistent with the rest.
Chun-wei Fan [Thu, 6 Oct 2011 07:37:52 +0000 (15:37 +0800)]
gobject/gclosure.c: Add type cast for int_val = value
This will silence compiler warnings on Visual C++.
(Sorry for the bad fix just now.)
Chun-wei Fan [Thu, 6 Oct 2011 07:33:34 +0000 (15:33 +0800)]
Revert "gobject/gclosure.c: Made up for missed pointer deref"
This reverts commit
d792a1ebe445cfab942ee9e079daa3b87bd60304.
Chun-wei Fan [Thu, 6 Oct 2011 07:24:08 +0000 (15:24 +0800)]
gobject/gclosure.c: Made up for missed pointer deref
The value parameter is a gpointer * (void **), but ffi_arg itself is not a
pointer type, so make up for dereference here.
Chun-wei Fan [Thu, 6 Oct 2011 07:12:22 +0000 (15:12 +0800)]
gthread-deprecated.c: Include gutils.h
This is needed for declaration of inline.
Chun-wei Fan [Thu, 6 Oct 2011 07:02:54 +0000 (15:02 +0800)]
config.h.win32(.in): Update for strcasecmp
Visual C++ uses _stricmp, which is identical to strcasecmp on gcc.
Matthias Clasen [Thu, 6 Oct 2011 02:43:22 +0000 (22:43 -0400)]
Update threads docs for the demise of g_thread_init()