Commit Graph

50 Commits

Author SHA1 Message Date
Dan Winship
59f1f54655 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
2011-10-07 10:14:34 -04:00
Dan Winship
7ca83c6c9f Fix up some doc comments that referred to threads not being enabled
(and a few other unrelated comment fixes)
2011-10-05 11:54:36 -04:00
Dan Winship
eba49a4f7f g_simple_async_result_complete_in_idle: add a minor doc clarification 2011-09-26 12:43:08 -04:00
Dan Winship
df45856bba GSimpleAsyncResult: push thread context around callback
When an old pre-thread-default-context API that takes an explicit
GMainContext wants to call a gio API, it must call
g_main_context_push_thread_default() before, and
g_main_context_pop_thread_default() after the gio call, so that the
gio method will return its result to the desired GMainContext.

But this fails for methods like g_socket_client_connect_async() that
make a chain of multiple async calls, since the pushed/popped context
will only affect the initial call.

Fix this by having GSimpleAsyncResult itself push/pop the context
around the callback invocation, so that if the callback queues another
async request, it will stay in the same context as the original one.

https://bugzilla.gnome.org/show_bug.cgi?id=646957
2011-04-26 11:32:11 -04:00
Pavel Holejsovsky
e78c27256a Add GI annotations to GSimpleAsyncResult 2010-12-21 18:21:33 +01:00
Christian Dywan
1f9e34cab7 Allow null object in g_simple_async_report_gerror_in_idle
Follow-up on bug 636673.
2010-12-20 17:22:19 +01:00
Christian Dywan
ddc126cf2c g_simple_async_report_error_in_idle with no object
Document and allow passing of NULL for the object consistently to
_take_error and _report_error functions.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=636673
2010-12-17 17:38:04 +01:00
Emilio Pozuelo Monfort
85adbc99bf Fix error in GSimpleAsyncResult example 2010-12-07 17:46:21 +01:00
Matthias Clasen
4b28e6a008 Add missing Since: tag
g_simple_async_result_is_valid was added in 2.20.

Bug 636351
2010-12-03 14:49:07 -05:00
Colin Walters
d11f413345 introspection: Remove spurious trailing :
This isn't valid syntax.
2010-12-03 14:26:28 -05:00
Christian Persch
ba45e36932 Add g_simple_async_report_take_gerror_in_idle
... and use it where appropriate. Saves an extra GError copy.

Bug #633686.
2010-11-03 14:38:08 +01:00
Christian Persch
7434c1725d Fix Since: for new functions
g_simple_async_result_new_from_error/take_error are Since: 2.28.
2010-11-01 11:06:26 +01:00
Matthias Clasen
85ba8596e2 GSimpleAsyncResult: add error-taking variants
Add g_simple_async_result_new_take_error and
g_simple_async_result_take_error, which take over ownership of the
given error. Based on a patch by Christian Persch.

https://bugzilla.gnome.org/show_bug.cgi?id=629247
2010-10-31 22:38:38 -04:00
Johan Dahlin
30132c44c1 Add a lot of missing annotations 2010-09-24 18:24:41 -03:00
Will Thompson
28a4fff7ec Add examples for GAsyncInitiable and GSimpleAsyncResult
Bug 602417
2010-08-13 23:34:44 -04:00
Will Thompson
7a32e34f7c Document that _complete() et al. ref the GSimpleAsyncResult 2010-08-13 23:20:06 -04:00
Will Thompson
ec31612ea0 _simple_async_result_is_valid: allow tag to be NULL
Because g_simple_async_report_[g]error_in_idle() don't take a source tag
parameter, code that uses them can't currently use
g_simple_async_result_is_valid() (at least, not for the error case).

Bug 602417
2010-08-13 23:15:27 -04:00
Matthias Clasen
7de6658f74 Make g_simple_async_result_is_valid work without source
The problem was pointed out by Xavier Claessens in bug 626208.
2010-08-07 17:10:17 -04:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Matthias Clasen
d819c8e486 Typo fixes 2010-01-24 20:50:51 -05:00
Matthias Clasen
a91514ba19 Document that various functions ref GSimpleAsyncResult
Patch by Will Thompson, see bug 602417.
2010-01-02 19:53:02 -05:00
Alexander Larsson
90e1308809 Avoid critical error in thread check if source is destroyed
The source can be destroyed by the time we complete the result, and
then the g_source_get_context(current_source) call will cause
a critical error. We check for the source being destroyed and avoid
the check in that case.

This means we miss the right-thread check in this case, but thats
merely a helper, so this is not critical.
2009-09-29 11:27:15 +02:00
Richard Hughes
cdd04f36ca Make the error const for g_simple_async_result_set_from_error 2009-09-11 15:20:34 +01:00
Alexander Larsson
06de24f430 Remove warning in g_simple_async_result_complete
This warning hits code that uses GSimpleAsyncResult outside of a
mainloop as a helper object. For instance EggDBus does this.
Since the bugs this warning would fix are pretty easy to spot
and since EggDBus is deployed already we just remove the
"called from outside main loop" warning.

However, we need to keep the "called from wrong context" warning
as that is very helpful when debugging misuse of the new multiple
main context code.
2009-09-07 10:25:14 +02:00
Dan Winship
65cc5d895a Support g_main_context_push_thread_default() in gio
GFile allows for the possibility that external implementations may not
support thread-default contexts yet, via
g_file_supports_thread_contexts(). GVolumeMonitor is not yet
thread-default-context aware.

Add a test program to verify that basic gio async ops work correctly
in non-default contexts.

http://bugzilla.gnome.org/show_bug.cgi?id=579984
2009-07-01 09:02:46 -04:00
Christian Persch
54b43229f4 Use g_error_new_valist instead of a private copy of it 2009-05-23 17:53:01 +02:00
Matthias Clasen
2e4b51aeb3 Plug a memory leak in g_simple_async_result_set_op_res_gpointer
Fixes bug 579272.
2009-05-02 22:59:02 -04:00
Ryan Lortie
2bd1d5d737 Bug 571598 – GAsyncResult with NULL gobject
2009-02-16  Ryan Lortie  <desrt@desrt.ca>

        Bug 571598 – GAsyncResult with NULL gobject

        * gsimpleasyncresult.c: remove various assertions and add some checks
        to allow for a NULL source_object in GSimpleAsyncResult.


svn path=/trunk/; revision=7864
2009-02-16 09:33:39 +00:00
Ryan Lortie
876f03f807 Add g_simple_async_result_is_valid(). Implementation by Dan Winship.
2009-01-05  Ryan Lortie  <desrt@desrt.ca>

        * gio.symbols:
        * ../docs/reference/gio/gio-sections.txt:
        * gsimpleasyncresult.h:
        * gsimpleasyncresult.c: Add g_simple_async_result_is_valid().
        Implementation by Dan Winship.  Closes #566170.


svn path=/trunk/; revision=7766
2009-01-05 06:57:16 +00:00
Alexander Larsson
3b4ad625b9 Bug 562452 - Ensure we return G_IO_ERROR_CANCELLED if cancelling
2008-12-10  Alexander Larsson  <alexl@redhat.com>

	Bug 562452 - Ensure we return G_IO_ERROR_CANCELLED if cancelling
	g_simple_async_result_run_in_thread
	
        * gsimpleasyncresult.c:
	Make g_simple_async_result_run_in_thread check cancellation before
	calling out to the user in the callback. This means we guarantee
	reporting cancels of async operations from the main threads, which
	is probably more in line with what users expect.
	
	Note that there are still no such guarantees for cancelling sync
	operations or cancelling async operation from outside the main
	thread. Furthermore, the exact behaviour of async implementations
	not using run_in_thread may differ.



svn path=/trunk/; revision=7740
2008-12-10 13:25:59 +00:00
Christian Persch
630f89fb1a Bug 555311 – format not a string literal and no format arguments
svn path=/trunk/; revision=7597
2008-10-13 12:43:37 +00:00
Matthias Clasen
6310f898b8 Fix gcc warnings
svn path=/trunk/; revision=7585
2008-10-10 04:54:51 +00:00
Cody Russell
3d93bf6968 Moved all relevant typedefs into these files.
2008-07-01  Cody Russell  <bratsche@gnome.org>

        * gio/gioenums.h:
        * gio/giotypes.h:
	Moved all relevant typedefs into these	files.

        * gio/*.[ch]:
	Updated wrt added files.

        Split types into separate file	for easier maintainership. (#538564)


svn path=/trunk/; revision=7127
2008-07-01 06:32:35 +00:00
Johan Dahlin
761424465a Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch


svn path=/trunk/; revision=7092
2008-06-22 15:10:51 +00:00
Michael Natterer
a4427bfff5 chain up unconditionally in finalize() and dispose(). Also don't
2008-06-16  Michael Natterer  <mitch@imendio.com>

	* *.c: chain up unconditionally in finalize() and dispose(). Also
	don't dereference these function pointers when calling them since
	that has no meaning at all.


svn path=/trunk/; revision=7048
2008-06-16 09:54:04 +00:00
Matthias Clasen
f3144c7efe Doc fixes
svn path=/trunk/; revision=6554
2008-02-21 18:20:17 +00:00
Matthias Clasen
8228f7f94b Make GIOSchedulerJobFunc return boolean Keep calling io jobs until they
2008-01-25  Matthias Clasen  <mclasen@redhat.com>

        * gioscheduler.h: Make GIOSchedulerJobFunc return boolean
        * gioscheduler.c: Keep calling io jobs until they return FALSE;
        this allows big jobs to be executed in chunks, instead of blocking
        the main loop for a long time.

        * gsimpleasyncresult.c:
        * giofile.c: Adapt callers.

svn path=/trunk/; revision=6375
2008-01-25 14:40:54 +00:00
Matthias Clasen
0debd52858 Fix up includes in section docs
svn path=/trunk/; revision=6149
2007-12-18 02:52:11 +00:00
Alexander Larsson
3db93c01b7 Rename gioscheduler calls so they all use the g_io_schedule_ prefix. Split
2007-12-14  Alexander Larsson  <alexl@redhat.com>

        * gioscheduler.[ch]:
        * gsimpleasyncresult.c:
	Rename gioscheduler calls so they all use the g_io_schedule_ prefix.
	Split out the send_to_mainloop call into two versions instead
	of having the block argument.


svn path=/trunk/; revision=6116
2007-12-14 09:42:59 +00:00
A. Walton
ab69ee2945 More documentation cleanup and filling in missing information, bringing
2007-12-09  A. Walton  <awalton@svn.gnome.org>

	* gdesktopappinfo.c:
	* gdrive.c:
	* gdrive.h:
	* gfile.c:
	* gfile.h:
	* gfileattribute.c:
	* gfileenumerator.c:
	* gioerror.c:
	* gioscheduler.c:
	* gioscheduler.h:
	* gloadableicon.c:
	* gmemoryinputstream.c:
	* gmemoryoutputstream.c:
	* goutputstream.h:
	* gsimpleasyncresult.c:
	More documentation cleanup and filling in missing information, 
bringing
	GIO to 99% symbol coverage.

svn path=/trunk/; revision=6077
2007-12-09 15:51:12 +00:00
Dan Winship
117de38f04 Make this take a GError and return a gboolean, and do the "outstanding
2007-11-30  Dan Winship  <danw@gnome.org>

	* ginputstream.c (g_input_stream_set_pending): Make this take a
	GError and return a gboolean, and do the "outstanding operation"
	check (and the "stream is already closed" check) itself.
	(g_input_stream_clear_pending): Formerly set_pending(FALSE).

	* goutputstream.c (g_output_stream_set_pending)
	(g_output_stream_clear_pending): Likewise

	* gbufferedinputstream.c: 
	* gfileinputstream.c: 
	* gfileoutputstream.c: Update for that

	* gsimpleasyncresult.c (g_simple_async_report_gerror_in_idle):
	Like g_simple_async_report_error_in_idle, but takes a GError
	rather than building one.


svn path=/trunk/; revision=6039
2007-12-04 08:57:04 +00:00
Hans Breuer
43ae389211 [start of port to win32/msvc] HAVE_UNIST_H and _pipe() only include
2007-12-03  Hans Breuer  <hans@breuer.org>

	[start of port to win32/msvc]
	* gcancellable.c : HAVE_UNIST_H and _pipe()
	* gcontenttype.c : only include <dirent.h> in the UNIX branch
	* gdatainputstream.c : pointer arithmetic on void* is a gcc extension
	* gdummyfile.c glocalfileinputstream.c gsimpleasyncresult.c : use 
	HAVE_UNIST_H
	* glocalfileoutputstream.c : use HAVE_UNIST_H and s/ssize_t/gssize/
	* glocalvfs.c : use HAVE_PWD_H
	* gio.symbols : ifdef unix specific functions with G_OS_UNIX
	* makefile.msc : new file (maybe later converted to makefile.msc.in)
	* Makefile.am : added to EXTRA_DIST

svn path=/trunk/; revision=6027
2007-12-03 22:37:44 +00:00
Matthias Clasen
650c65e892 Doc improvements
svn path=/trunk/; revision=6005
2007-12-01 04:38:29 +00:00
Matthias Clasen
a2ca589703 More coding style fixes
svn path=/trunk/; revision=5999
2007-11-30 05:11:25 +00:00
Andrew Walton
0c867d3444 Fixes unknown meaning in GAppLaunchContext docs. Clarify asynchronous ops.
* gappinfo.c:
	  Fixes unknown meaning in GAppLaunchContext docs.
	* gfile.c:
	  Clarify asynchronous ops.
	* gfileattribute.c:
	  Fix entity tag docs.
	* gicon.c:
	* gthemedicon.c:
	  Provides missing gtk-doc section, fixes API docs slighly.
	* gsimpleasyncresult.c:
	  Fill in missing info in docs.
	* gunixinputstream.c:
	* gunixoutputstream.c:
	  Be more expressive in short description.
	* gunixvolume.c:
	  Remove gtk-doc stubs for non-public API.


svn path=/trunk/; revision=5994
2007-11-29 10:18:55 +00:00
Alexander Larsson
7f3280230b Added. Added. Added. Added.
2007-11-28  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * abicheck.sh: Added.
        * makegioalias.pl: Added.
        * pltcheck.sh: Added.
        * gio.symbols: Added.
	* *.c:
        * inotify/*.c
	Initial work on adding symbol handling.

	* gvfs.h:
	Correct ifdef guard name

        * fam/Makefile.am:
        * inotify/Makefile.am:
        * xdgmime/Makefile.am:
	Include toplevel Makefile.decl


svn path=/trunk/; revision=5972
2007-11-28 12:39:07 +00:00
Matthias Clasen
61582bd91c Another round of trivial doc fixes
svn path=/trunk/; revision=5970
2007-11-28 06:43:33 +00:00
Matthias Clasen
54e52e099e More trivial doc fixes
svn path=/trunk/; revision=5968
2007-11-28 06:01:13 +00:00
Andrew Walton
5247f12f36 Bumps documentation to 93% symbol coverage, touching most
of the public files. Fixes broken function documentation prototypes. 
	Fixes GCancellable inaccuracies. Removes unnecessary incomplete 
	gtk-doc headers in private files.

svn path=/trunk/; revision=5953
2007-11-27 14:00:13 +00:00
Alexander Larsson
3781343738 gio/ docs/reference/gio Merged gio-standalone into glib.
2007-11-26  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * configure.in:
        * gio-2.0-uninstalled.pc.in:
        * gio-2.0.pc.in: 
        * gio-unix-2.0-uninstalled.pc.in:
        * gio-unix-2.0.pc.in:
	* gio/
	* docs/reference/gio
	Merged gio-standalone into glib.
	
        * glib/glibintl.h:
        * glib/gutils.c:
	Export glib_gettext so that gio can use it
	Add P_ (using same domain for now)
	Add I_ as g_intern_static_string


svn path=/trunk/; revision=5941
2007-11-26 16:13:05 +00:00