Commit Graph

11110 Commits

Author SHA1 Message Date
Matthias Clasen
976b0b72a4 Include genviron.h where necessary 2011-10-15 20:06:32 -04:00
Matthias Clasen
327e72f9fb And fix the syntax, too 2011-10-15 19:39:14 -04:00
Matthias Clasen
7df9637f0f Forgotten file 2011-10-15 19:38:10 -04:00
Matthias Clasen
d4dfca21bb Drop unused copy of _g_getenv_nomalloc 2011-10-15 18:23:07 -04:00
Simon McVittie
a7143a0e9f GDBusConnection: warn that direct access to the stream is a bad idea
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661679
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-15 18:03:19 -04:00
Torsten Schönfeld
70eff50f21 Add two annotations to gio
https://bugzilla.gnome.org/show_bug.cgi?id=656679
2011-10-15 18:02:32 -04:00
Simon McVittie
5dcc502f91 Document that types are limited to 64 KiB
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=659916
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-15 17:59:35 -04:00
Kean Johnston
33a86fce6a GIOModule: Use G_SEARCHPATH_SEPARATOR_S instead of ":"
https://bugzilla.gnome.org/show_bug.cgi?id=661257
2011-10-15 17:58:39 -04:00
Giovanni Campagna
94accc2d78 GKeyFile: improve introspection annotations
Ensure that all methods that take or return arrays are annotated
(including length). Mark ref, unref and free methods as (skip).

https://bugzilla.gnome.org/show_bug.cgi?id=590808
2011-10-15 17:54:41 -04:00
Giovanni Campagna
96817746d9 Turn GKeyFile into a boxed for introspection
Using the new refcounting API, introduce a boxed type wrapping
GKeyFile and expose it introspection bindings in glib-types.h.
2011-10-15 17:51:25 -04:00
Christian Persch
a57c9148cf GKeyFile: Add refcounting API
Adds g_key_file_ref and g_key_file_unref, to be used by a future
GKeyFile boxed type for language bindings.

Based on the patch by Christian Persch and Emmanuele Bassi.

Author: Christian Persch
Signed-off-by: Johan Dahlin
Signed-off-by: Giovanni Campagna

https://bugzilla.gnome.org/show_bug.cgi?id=590808
2011-10-15 17:44:45 -04:00
Matthias Clasen
dfd75d2ead Add 'Since 2.32' indexes to gio and gobject docs 2011-10-15 17:31:47 -04:00
Dan Winship
de834bed30 GAppLaunchContext: add environment-manipulating functions
Add functions for manipulating the environment under which a
GAppLaunchContext will launch its children, to avoid thread-related
bugs with using setenv() directly.

FIXME: win32 side isn't implemented yet

https://bugzilla.gnome.org/show_bug.cgi?id=659326
2011-10-15 17:30:55 -04:00
Matthias Clasen
117e534091 Misc doc formatting fixes 2011-10-15 17:00:56 -04:00
Matthias Clasen
94c246e8e3 Add tests for new g_environ_ functions 2011-10-15 16:28:07 -04:00
Matthias Clasen
7a9987d35d Move environment-related functions into their own files
gutils.[hc] is a bit of a grab bag, so lets start cleaning
things up by moving all the environment-related functions
into separate genviron.[hc] files.

The private _g_getenv_nomalloc has been moved to its sole caller.
2011-10-15 16:13:08 -04:00
Dan Winship
409d93148f gutils: Add functions for working with environment arrays
When spawning a child process, it is not safe to call setenv() before
the fork() (because setenv() isn't thread-safe), but it's also not
safe to call it after the fork() (because it's not async-signal-safe).
So the only safe way to alter the environment for a child process from
a threaded program is to pass a fully-formed envp array to
exec*/g_spawn*/etc.

So, add g_environ_getenv(), g_environ_setenv(), and
g_environ_unsetenv(), which act like their namesakes, but work on
arbitrary arrays rather than working directly on the environment.

http://bugzilla.gnome.org/show_bug.cgi?id=659326
2011-10-15 15:54:45 -04:00
Ryan Lortie
5ff803d91f Add to the pitfalls: fork() and daemon() 2011-10-15 13:27:46 -04:00
Ryan Lortie
ef6371ff74 tests/Makefile.am: remove unused LDFLAGS variable 2011-10-15 13:13:13 -04:00
Matthias Clasen
6651bd221e Expand thread docs a bit
Add some discussion of pitfalls of threaded programming.
2011-10-15 13:04:20 -04:00
Matthias Clasen
e4699af8eb Documentation tweaks 2011-10-15 11:37:03 -04:00
Fran Dieguez
55654fc8ad Updaged Galician translations 2011-10-15 16:29:50 +02:00
Ryan Lortie
3fe3fdd75a 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.
2011-10-15 09:48:42 -04:00
Ryan Lortie
11f3684b71 gtk-doc g_thread_ref() and g_thread_unref() 2011-10-15 09:48:22 -04:00
Ryan Lortie
e75e9c3044 Rename g_thread_try to g_thread_try_new 2011-10-15 09:48:10 -04:00
Matthias Clasen
4417e77f17 Add atomic test to TEST_PROGS 2011-10-15 00:56:08 -04:00
Matthias Clasen
482bb38748 Documentation additions 2011-10-15 00:26:02 -04:00
Matthias Clasen
8bc8cd7aa0 Improve test coverage 2011-10-15 00:09:20 -04:00
Matthias Clasen
52321def8f Add a test involving g_thread_ref/unref
Also, fix the resource-limit test to properly unset RLIMIT_NPROC.
2011-10-14 23:20:06 -04:00
Matthias Clasen
81431fa5b8 Add g_thread_try to the docs 2011-10-14 23:12:06 -04:00
Matthias Clasen
d000bf67f7 Update doc lists 2011-10-14 23:01:05 -04:00
Matthias Clasen
5ddcc284e8 Minor doc clarifications 2011-10-14 23:00:17 -04:00
Ryan Lortie
a6da2b9ff9 Mention thread API changes in README 2011-10-14 21:52:36 -04:00
Ryan Lortie
4359cbd810 I read the news today, oh boy... 2011-10-14 21:48:20 -04:00
Ryan Lortie
7ab25865f2 Stop checking for fork() across GMainContext
01ed78d525 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...
2011-10-14 20:01:22 -04:00
Ryan Lortie
51773c6c64 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.
2011-10-14 20:01:22 -04:00
Florian Müllner
1ed88f0615 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
2011-10-14 23:30:21 +02:00
Ryan Lortie
14e3b12823 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...
2011-10-14 00:00:14 -04:00
Ryan Lortie
4033c616ff 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.
2011-10-13 23:44:17 -04:00
Ryan Lortie
fd382156b8 tests: disable deprecation warnings for tests
We need to test deprecated functions, so don't warn us for doing so.
2011-10-13 10:51:35 -04:00
Ryan Lortie
3ebdb4d46a gutils: stop using GStaticPrivate
This was our last internal use.
2011-10-13 09:14:57 -04:00
Ryan Lortie
62fe053268 Revert "make struct _GThread private"
This reverts commit d904612100.

glibmm touches the contents of GThread, so this broke their build.
2011-10-13 09:00:54 -04:00
Ryan Lortie
d904612100 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.
2011-10-13 01:34:08 -04:00
Ryan Lortie
b1cc2579c1 tidy up gthreadprivate.h
Remove some unused includes, too.
2011-10-13 01:22:51 -04:00
Ryan Lortie
332f74a2fc 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().
2011-10-13 01:17:36 -04:00
Ryan Lortie
430c5635f2 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.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 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().
2011-10-13 00:43:33 -04:00
Ryan Lortie
b0e73ca390 GThread: make refcounting public 2011-10-13 00:29:04 -04:00
Ryan Lortie
62be9365d9 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.
2011-10-13 00:18:17 -04:00
Ryan Lortie
becb4b820f remove 'joinable' parameter to backends
Both backends are now oblivious to the concept of joinability, so don't
bother passing the parameter.
2011-10-13 00:01:28 -04:00