~ubuntu-branches/ubuntu/trusty/rgtk2/trusty

« back to all changes in this revision

Viewing changes to man/GSimpleAsyncResult.Rd

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2010-11-03 11:35:46 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20101103113546-a7fi7jdxdebp0tw1
Tags: 2.20.1-1
* New upstream release

* debian/control: Set (Build-)Depends: to current R version
* debian/control: Set Standards-Version: to current version 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\alias{GSimpleAsyncResult}
 
2
\alias{gSimpleAsyncResult}
 
3
\alias{GSimpleAsyncThreadFunc}
 
4
\name{GSimpleAsyncResult}
 
5
\title{GSimpleAsyncResult}
 
6
\description{Simple asynchronous results implementation}
 
7
\section{Methods and Functions}{
 
8
\code{\link{gSimpleAsyncResultNew}(source.object, callback, user.data = NULL, source.tag)}\cr
 
9
\code{\link{gSimpleAsyncResultNewError}(source.object, callback, user.data, domain, code, format, ...)}\cr
 
10
\code{\link{gSimpleAsyncResultNewFromError}(source.object, callback, user.data = NULL)}\cr
 
11
\code{\link{gSimpleAsyncResultSetOpResGpointer}(object, op.res)}\cr
 
12
\code{\link{gSimpleAsyncResultGetOpResGpointer}(object)}\cr
 
13
\code{\link{gSimpleAsyncResultSetOpResGssize}(object, op.res)}\cr
 
14
\code{\link{gSimpleAsyncResultGetOpResGssize}(object)}\cr
 
15
\code{\link{gSimpleAsyncResultSetOpResGboolean}(object, op.res)}\cr
 
16
\code{\link{gSimpleAsyncResultGetOpResGboolean}(object)}\cr
 
17
\code{\link{gSimpleAsyncResultGetSourceTag}(object)}\cr
 
18
\code{\link{gSimpleAsyncResultSetHandleCancellation}(object, handle.cancellation)}\cr
 
19
\code{\link{gSimpleAsyncResultComplete}(object)}\cr
 
20
\code{\link{gSimpleAsyncResultCompleteInIdle}(object)}\cr
 
21
\code{\link{gSimpleAsyncResultSetFromError}(object)}\cr
 
22
\code{\link{gSimpleAsyncResultPropagateError}(object, .errwarn = TRUE)}\cr
 
23
\code{\link{gSimpleAsyncResultSetError}(object, domain, code, format, ...)}\cr
 
24
\code{\link{gSimpleAsyncReportErrorInIdle}(object, callback, user.data, domain, code, format, ...)}\cr
 
25
\code{\link{gSimpleAsyncReportGerrorInIdle}(object, callback, user.data = NULL)}\cr
 
26
\code{gSimpleAsyncResult(source.object, callback, user.data = NULL, source.tag, domain, code, format, ...)}
 
27
}
 
28
\section{Hierarchy}{\preformatted{GObject
 
29
   +----GSimpleAsyncResult}}
 
30
\section{Interfaces}{GSimpleAsyncResult implements
 
31
 \code{\link{GAsyncResult}}.}
 
32
\section{Detailed Description}{Implements \code{\link{GAsyncResult}} for simple cases. Most of the time, this 
 
33
will be all an application needs, and will be used transparently. 
 
34
Because of this, \code{\link{GSimpleAsyncResult}} is used throughout GIO for 
 
35
handling asynchronous functions. 
 
36
  
 
37
GSimpleAsyncResult handles \code{\link{GAsyncReadyCallback}}s, error 
 
38
reporting, operation cancellation and the final state of an operation, 
 
39
completely transparent to the application. Results can be returned 
 
40
as a pointer e.g. for functions that return data that is collected 
 
41
asynchronously, a boolean value for checking the success or failure 
 
42
of an operation, or a \verb{integer} for operations which return the number 
 
43
of bytes modified by the operation; all of the simple return cases 
 
44
are covered.
 
45
  
 
46
Most of the time, an application will not need to know of the details 
 
47
of this API; it is handled transparently, and any necessary operations 
 
48
are handled by \code{\link{GAsyncResult}}'s interface. However, if implementing a 
 
49
new GIO module, for writing language bindings, or for complex 
 
50
applications that need better control of how asynchronous operations 
 
51
are completed, it is important to understand this functionality.
 
52
  
 
53
GSimpleAsyncResults are tagged with the calling function to ensure 
 
54
that asynchronous functions and their finishing functions are used 
 
55
together correctly.
 
56
  
 
57
To create a new \code{\link{GSimpleAsyncResult}}, call \code{\link{gSimpleAsyncResultNew}}. 
 
58
If the result needs to be created for a \code{\link{GError}}, use 
 
59
\code{\link{gSimpleAsyncResultNewFromError}}. If a \code{\link{GError}} is not available 
 
60
(e.g. the asynchronous operation's doesn't take a \code{\link{GError}} argument), 
 
61
but the result still needs to be created for an error condition, use
 
62
\code{\link{gSimpleAsyncResultNewError}} (or \code{gSimpleAsyncResultSetErrorVa()}
 
63
if your application or binding requires passing a variable argument list 
 
64
directly), and the error can then be propegated through the use of 
 
65
\code{\link{gSimpleAsyncResultPropagateError}}.
 
66
  
 
67
An asynchronous operation can be made to ignore a cancellation event by 
 
68
calling \code{\link{gSimpleAsyncResultSetHandleCancellation}} with a 
 
69
\code{\link{GSimpleAsyncResult}} for the operation and \code{FALSE}. This is useful for
 
70
operations that are dangerous to cancel, such as close (which would
 
71
cause a leak if cancelled before being run).
 
72
  
 
73
GSimpleAsyncResult can integrate into GLib's event loop, \verb{GMainLoop}, 
 
74
or it can use \verb{GThread}s if available. 
 
75
\code{\link{gSimpleAsyncResultComplete}} will finish an I/O task directly
 
76
from the point where it is called. \code{\link{gSimpleAsyncResultCompleteInIdle}}
 
77
will finish it from an idle handler in the thread-default main
 
78
context. \code{gSimpleAsyncResultRunInThread()} will run the
 
79
job in a separate thread and then deliver the result to the
 
80
thread-default main context.
 
81
  
 
82
To set the results of an asynchronous function, 
 
83
\code{\link{gSimpleAsyncResultSetOpResGpointer}}, 
 
84
\code{\link{gSimpleAsyncResultSetOpResGboolean}}, and 
 
85
\code{\link{gSimpleAsyncResultSetOpResGssize}}
 
86
are provided, setting the operation's result to a gpointer, gboolean, or 
 
87
gssize, respectively.
 
88
  
 
89
Likewise, to get the result of an asynchronous function, 
 
90
\code{\link{gSimpleAsyncResultGetOpResGpointer}},
 
91
\code{\link{gSimpleAsyncResultGetOpResGboolean}}, and 
 
92
\code{\link{gSimpleAsyncResultGetOpResGssize}} are 
 
93
provided, getting the operation's result as a gpointer, gboolean, and 
 
94
gssize, respectively.}
 
95
\section{Structures}{\describe{\item{\verb{GSimpleAsyncResult}}{
 
96
A simple implementation of \code{\link{GAsyncResult}}.
 
97
 
 
98
}}}
 
99
\section{Convenient Construction}{\code{gSimpleAsyncResult} is the result of collapsing the constructors of \code{GSimpleAsyncResult} (\code{\link{gSimpleAsyncResultNew}}, \code{\link{gSimpleAsyncResultNewError}}, \code{\link{gSimpleAsyncResultNewFromError}}) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.}
 
100
\section{User Functions}{\describe{\item{\code{GSimpleAsyncThreadFunc(res, object, cancellable)}}{
 
101
Simple thread function that runs an asynchronous operation and
 
102
checks for cancellation.
 
103
 
 
104
\describe{
 
105
\item{\code{res}}{a \code{\link{GSimpleAsyncResult}}.}
 
106
\item{\code{object}}{a \code{\link{GObject}}.}
 
107
\item{\code{cancellable}}{optional \code{\link{GCancellable}} object, \code{NULL} to ignore.}
 
108
}
 
109
 
 
110
 
 
111
}}}
 
112
\references{\url{http://library.gnome.org/devel//gio/GSimpleAsyncResult.html}}
 
113
\author{Derived by RGtkGen from GTK+ documentation}
 
114
\keyword{internal}