Learn R Programming

RGtk2 (version 2.20.31)

GSimpleAsyncResult: GSimpleAsyncResult

Description

Simple asynchronous results implementation

Arguments

Methods and Functions

gSimpleAsyncResultNew(source.object, callback, user.data = NULL, source.tag) gSimpleAsyncResultNewError(source.object, callback, user.data, domain, code, format, ...) gSimpleAsyncResultNewFromError(source.object, callback, user.data = NULL) gSimpleAsyncResultSetOpResGpointer(object, op.res) gSimpleAsyncResultGetOpResGpointer(object) gSimpleAsyncResultSetOpResGssize(object, op.res) gSimpleAsyncResultGetOpResGssize(object) gSimpleAsyncResultSetOpResGboolean(object, op.res) gSimpleAsyncResultGetOpResGboolean(object) gSimpleAsyncResultGetSourceTag(object) gSimpleAsyncResultSetHandleCancellation(object, handle.cancellation) gSimpleAsyncResultComplete(object) gSimpleAsyncResultCompleteInIdle(object) gSimpleAsyncResultSetFromError(object) gSimpleAsyncResultPropagateError(object, .errwarn = TRUE) gSimpleAsyncResultSetError(object, domain, code, format, ...) gSimpleAsyncReportErrorInIdle(object, callback, user.data, domain, code, format, ...) gSimpleAsyncReportGerrorInIdle(object, callback, user.data = NULL) gSimpleAsyncResult(source.object, callback, user.data = NULL, source.tag, domain, code, format, ...)

Hierarchy

GObject
   +----GSimpleAsyncResult

Interfaces

GSimpleAsyncResult implements GAsyncResult.

Detailed Description

Implements GAsyncResult for simple cases. Most of the time, this will be all an application needs, and will be used transparently. Because of this, GSimpleAsyncResult is used throughout GIO for handling asynchronous functions. GSimpleAsyncResult handles GAsyncReadyCallbacks, error reporting, operation cancellation and the final state of an operation, completely transparent to the application. Results can be returned as a pointer e.g. for functions that return data that is collected asynchronously, a boolean value for checking the success or failure of an operation, or a integer for operations which return the number of bytes modified by the operation; all of the simple return cases are covered. Most of the time, an application will not need to know of the details of this API; it is handled transparently, and any necessary operations are handled by GAsyncResult's interface. However, if implementing a new GIO module, for writing language bindings, or for complex applications that need better control of how asynchronous operations are completed, it is important to understand this functionality. GSimpleAsyncResults are tagged with the calling function to ensure that asynchronous functions and their finishing functions are used together correctly. To create a new GSimpleAsyncResult, call gSimpleAsyncResultNew. If the result needs to be created for a GError, use gSimpleAsyncResultNewFromError. If a GError is not available (e.g. the asynchronous operation's doesn't take a GError argument), but the result still needs to be created for an error condition, use gSimpleAsyncResultNewError (or gSimpleAsyncResultSetErrorVa() if your application or binding requires passing a variable argument list directly), and the error can then be propegated through the use of gSimpleAsyncResultPropagateError. An asynchronous operation can be made to ignore a cancellation event by calling gSimpleAsyncResultSetHandleCancellation with a GSimpleAsyncResult for the operation and FALSE. This is useful for operations that are dangerous to cancel, such as close (which would cause a leak if cancelled before being run). GSimpleAsyncResult can integrate into GLib's event loop, GMainLoop, or it can use GThreads if available. gSimpleAsyncResultComplete will finish an I/O task directly from the point where it is called. gSimpleAsyncResultCompleteInIdle will finish it from an idle handler in the thread-default main context. gSimpleAsyncResultRunInThread() will run the job in a separate thread and then deliver the result to the thread-default main context. To set the results of an asynchronous function, gSimpleAsyncResultSetOpResGpointer, gSimpleAsyncResultSetOpResGboolean, and gSimpleAsyncResultSetOpResGssize are provided, setting the operation's result to a gpointer, gboolean, or gssize, respectively. Likewise, to get the result of an asynchronous function, gSimpleAsyncResultGetOpResGpointer, gSimpleAsyncResultGetOpResGboolean, and gSimpleAsyncResultGetOpResGssize are provided, getting the operation's result as a gpointer, gboolean, and gssize, respectively.

Structures

Convenient Construction

gSimpleAsyncResult is the result of collapsing the constructors of GSimpleAsyncResult (gSimpleAsyncResultNew, gSimpleAsyncResultNewError, gSimpleAsyncResultNewFromError) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

User Functions

References

http://library.gnome.org/devel//gio/GSimpleAsyncResult.html