glib2 1.1.9-x86-mingw32 → 1.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (517) hide show
  1. data/Rakefile +26 -4
  2. data/ext/glib2/glib2.def +3 -1
  3. data/ext/glib2/rbgcompat.h +0 -15
  4. data/ext/glib2/rbglib.h +11 -3
  5. data/ext/glib2/rbglib_source.c +6 -1
  6. data/ext/glib2/rbgobj_boxed.c +65 -48
  7. data/ext/glib2/rbgobj_convert.c +29 -14
  8. data/ext/glib2/rbgobj_value.c +42 -0
  9. data/ext/glib2/rbgobject.c +7 -4
  10. data/ext/glib2/rbgobject.h +15 -9
  11. data/lib/1.8/glib2.so +0 -0
  12. data/lib/1.9/glib2.so +0 -0
  13. data/lib/gnome2-raketask.rb +6 -1
  14. data/lib/gnome2-win32-binary-build-task.rb +40 -10
  15. data/vendor/local/bin/certtool.exe +0 -0
  16. data/vendor/local/bin/danetool.exe +0 -0
  17. data/vendor/local/bin/gdbus-codegen +1 -1
  18. data/vendor/local/bin/gdbus.exe +0 -0
  19. data/vendor/local/bin/gio-querymodules.exe +0 -0
  20. data/vendor/local/bin/glib-compile-resources.exe +0 -0
  21. data/vendor/local/bin/glib-compile-schemas.exe +0 -0
  22. data/vendor/local/bin/glib-genmarshal.exe +0 -0
  23. data/vendor/local/bin/glib-gettextize +1 -1
  24. data/vendor/local/bin/glib-mkenums +1 -1
  25. data/vendor/local/bin/gnutls-cli-debug.exe +0 -0
  26. data/vendor/local/bin/gnutls-cli.exe +0 -0
  27. data/vendor/local/bin/gnutls-serv.exe +0 -0
  28. data/vendor/local/bin/gobject-query.exe +0 -0
  29. data/vendor/local/bin/gresource.exe +0 -0
  30. data/vendor/local/bin/gsettings.exe +0 -0
  31. data/vendor/local/bin/gspawn-win32-helper-console.exe +0 -0
  32. data/vendor/local/bin/gspawn-win32-helper.exe +0 -0
  33. data/vendor/local/bin/libgio-2.0-0.dll +0 -0
  34. data/vendor/local/bin/libglib-2.0-0.dll +0 -0
  35. data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
  36. data/vendor/local/bin/libgmp-10.dll +0 -0
  37. data/vendor/local/bin/libgnutls-28.dll +0 -0
  38. data/vendor/local/bin/libgnutls-openssl-27.dll +0 -0
  39. data/vendor/local/bin/libgnutls-openssl-28.def +87 -93
  40. data/vendor/local/bin/libgnutlsxx-28.dll +0 -0
  41. data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
  42. data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
  43. data/vendor/local/bin/libhogweed-2-2.dll +0 -0
  44. data/vendor/local/bin/libnettle-4-4.dll +0 -0
  45. data/vendor/local/bin/nettle-hash.exe +0 -0
  46. data/vendor/local/bin/nettle-lfib-stream.exe +0 -0
  47. data/vendor/local/bin/ocsptool.exe +0 -0
  48. data/vendor/local/bin/pkcs1-conv.exe +0 -0
  49. data/vendor/local/bin/psktool.exe +0 -0
  50. data/vendor/local/bin/sexp-conv.exe +0 -0
  51. data/vendor/local/bin/srptool.exe +0 -0
  52. data/vendor/local/{lib/libffi-3.0.6/include → include}/ffi.h +0 -0
  53. data/vendor/local/{lib/libffi-3.0.6/include → include}/ffitarget.h +0 -0
  54. data/vendor/local/include/glib-2.0/gio/gactionmap.h +0 -4
  55. data/vendor/local/include/glib-2.0/gio/gappinfo.h +1 -3
  56. data/vendor/local/include/glib-2.0/gio/gapplication.h +0 -1
  57. data/vendor/local/include/glib-2.0/gio/gapplicationcommandline.h +0 -4
  58. data/vendor/local/include/glib-2.0/gio/gcontenttype.h +0 -1
  59. data/vendor/local/include/glib-2.0/gio/gdbusnamewatching.h +1 -6
  60. data/vendor/local/include/glib-2.0/gio/gfile.h +0 -3
  61. data/vendor/local/include/glib-2.0/gio/gfileenumerator.h +0 -3
  62. data/vendor/local/include/glib-2.0/gio/gfileinfo.h +0 -2
  63. data/vendor/local/include/glib-2.0/gio/ginetaddressmask.h +0 -6
  64. data/vendor/local/include/glib-2.0/gio/gio.h +0 -1
  65. data/vendor/local/include/glib-2.0/gio/gioenums.h +1 -3
  66. data/vendor/local/include/glib-2.0/gio/giomodule.h +0 -5
  67. data/vendor/local/include/glib-2.0/gio/gioscheduler.h +0 -4
  68. data/vendor/local/include/glib-2.0/gio/giotypes.h +0 -1
  69. data/vendor/local/include/glib-2.0/gio/gmemoryoutputstream.h +0 -2
  70. data/vendor/local/include/glib-2.0/gio/gmenu.h +0 -27
  71. data/vendor/local/include/glib-2.0/gio/gmenumodel.h +0 -19
  72. data/vendor/local/include/glib-2.0/gio/gresource.h +0 -2
  73. data/vendor/local/include/glib-2.0/gio/gsettingsschema.h +0 -4
  74. data/vendor/local/include/glib-2.0/gio/gsimpleaction.h +0 -1
  75. data/vendor/local/include/glib-2.0/gio/gsimpleactiongroup.h +0 -1
  76. data/vendor/local/include/glib-2.0/gio/gsocket.h +0 -13
  77. data/vendor/local/include/glib-2.0/glib/deprecated/gthread.h +0 -1
  78. data/vendor/local/include/glib-2.0/glib/gchecksum.h +1 -3
  79. data/vendor/local/include/glib-2.0/glib/gconvert.h +9 -24
  80. data/vendor/local/include/glib-2.0/glib/gdir.h +8 -10
  81. data/vendor/local/include/glib-2.0/glib/genviron.h +8 -12
  82. data/vendor/local/include/glib-2.0/glib/gfileutils.h +15 -20
  83. data/vendor/local/include/glib-2.0/glib/giochannel.h +4 -14
  84. data/vendor/local/include/glib-2.0/glib/gslice.h +0 -4
  85. data/vendor/local/include/glib-2.0/glib/gspawn.h +10 -46
  86. data/vendor/local/include/glib-2.0/glib/gtestutils.h +0 -1
  87. data/vendor/local/include/glib-2.0/glib/gunicode.h +5 -5
  88. data/vendor/local/include/glib-2.0/glib/gutils.h +14 -14
  89. data/vendor/local/include/glib-2.0/glib/gvariant.h +0 -8
  90. data/vendor/local/include/glib-2.0/glib/gversionmacros.h +0 -24
  91. data/vendor/local/include/glib-2.0/glib/gwin32.h +7 -14
  92. data/vendor/local/include/glib-2.0/gmodule.h +7 -11
  93. data/vendor/local/include/glib-2.0/gobject/glib-types.h +0 -33
  94. data/vendor/local/include/glib-2.0/gobject/gobject.h +7 -7
  95. data/vendor/local/include/glib-2.0/gobject/gtype.h +7 -13
  96. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/__init__.py +0 -0
  97. data/vendor/local/lib/gdbus-2.0/codegen/__init__.pyc +0 -0
  98. data/vendor/local/lib/gdbus-2.0/codegen/__init__.pyo +0 -0
  99. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.py +0 -0
  100. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.pyc +0 -0
  101. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen.pyo +0 -0
  102. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.py +0 -0
  103. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.pyc +0 -0
  104. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_docbook.pyo +0 -0
  105. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.py +0 -2
  106. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.pyc +0 -0
  107. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/codegen_main.pyo +0 -0
  108. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/config.py +1 -1
  109. data/vendor/local/lib/gdbus-2.0/codegen/config.pyc +0 -0
  110. data/vendor/local/lib/gdbus-2.0/codegen/config.pyo +0 -0
  111. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.py +0 -0
  112. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.pyc +0 -0
  113. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/dbustypes.pyo +0 -0
  114. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.py +0 -0
  115. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.pyc +0 -0
  116. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/parser.pyo +0 -0
  117. data/vendor/local/{share/glib-2.0 → lib/gdbus-2.0}/codegen/utils.py +0 -0
  118. data/vendor/local/lib/gdbus-2.0/codegen/utils.pyc +0 -0
  119. data/vendor/local/lib/gdbus-2.0/codegen/utils.pyo +0 -0
  120. data/vendor/local/lib/gio-2.0.def +2 -41
  121. data/vendor/local/lib/gio/modules/libgiognutls.a +0 -0
  122. data/vendor/local/lib/gio/modules/libgiognutls.dll +0 -0
  123. data/vendor/local/lib/gio/modules/libgiognutls.dll.a +0 -0
  124. data/vendor/local/lib/gio/modules/libgiognutls.la +1 -1
  125. data/vendor/local/lib/glib-2.0.def +0 -2
  126. data/vendor/local/lib/glib-2.0/include/glibconfig.h +1 -1
  127. data/vendor/local/lib/gobject-2.0.def +0 -4
  128. data/vendor/local/lib/libgio-2.0.dll.a +0 -0
  129. data/vendor/local/lib/libgio-2.0.la +4 -4
  130. data/vendor/local/lib/libglib-2.0.dll.a +0 -0
  131. data/vendor/local/lib/libglib-2.0.la +3 -3
  132. data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
  133. data/vendor/local/lib/libgmodule-2.0.la +3 -3
  134. data/vendor/local/lib/libgmp.dll.a +0 -0
  135. data/vendor/local/lib/libgnutls-openssl.a +0 -0
  136. data/vendor/local/lib/libgnutls-openssl.dll.a +0 -0
  137. data/vendor/local/lib/libgnutls.a +0 -0
  138. data/vendor/local/lib/libgnutls.dll.a +0 -0
  139. data/vendor/local/lib/libgnutlsxx.a +0 -0
  140. data/vendor/local/lib/libgnutlsxx.dll.a +0 -0
  141. data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
  142. data/vendor/local/lib/libgobject-2.0.la +4 -4
  143. data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
  144. data/vendor/local/lib/libgthread-2.0.la +3 -3
  145. data/vendor/local/lib/libhogweed.a +0 -0
  146. data/vendor/local/lib/libhogweed.dll.a +0 -0
  147. data/vendor/local/lib/libnettle.a +0 -0
  148. data/vendor/local/lib/libnettle.dll.a +0 -0
  149. data/vendor/local/lib/pkgconfig/gio-2.0.pc +1 -1
  150. data/vendor/local/lib/pkgconfig/gio-windows-2.0.pc +1 -1
  151. data/vendor/local/lib/pkgconfig/glib-2.0.pc +1 -1
  152. data/vendor/local/lib/pkgconfig/gmodule-2.0.pc +1 -1
  153. data/vendor/local/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  154. data/vendor/local/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  155. data/vendor/local/lib/pkgconfig/gobject-2.0.pc +1 -1
  156. data/vendor/local/lib/pkgconfig/gthread-2.0.pc +1 -1
  157. data/vendor/local/share/gdb/auto-load/{libglib-2.0.so.0.3503.0-gdb.py → libglib-2.0.so.0.3400.3-gdb.py} +0 -0
  158. data/vendor/local/share/gdb/auto-load/{libgobject-2.0.so.0.3503.0-gdb.py → libgobject-2.0.so.0.3400.3-gdb.py} +0 -0
  159. data/vendor/local/share/glib-2.0/gdb/glib.py +4 -0
  160. data/vendor/local/share/glib-2.0/gettext/mkinstalldirs +2 -2
  161. data/vendor/local/share/glib-2.0/gettext/po/Makefile.in.in +17 -5
  162. data/vendor/local/share/gtk-doc/html/gio/GActionMap.html +1 -1
  163. data/vendor/local/share/gtk-doc/html/gio/GAppInfo.html +1 -27
  164. data/vendor/local/share/gtk-doc/html/gio/GApplication.html +15 -8
  165. data/vendor/local/share/gtk-doc/html/gio/GApplicationCommandLine.html +6 -47
  166. data/vendor/local/share/gtk-doc/html/gio/GAsyncInitable.html +37 -21
  167. data/vendor/local/share/gtk-doc/html/gio/GAsyncResult.html +4 -16
  168. data/vendor/local/share/gtk-doc/html/gio/GBufferedInputStream.html +1 -1
  169. data/vendor/local/share/gtk-doc/html/gio/GDBusAuthObserver.html +1 -1
  170. data/vendor/local/share/gtk-doc/html/gio/GDBusConnection.html +32 -16
  171. data/vendor/local/share/gtk-doc/html/gio/GDBusInterfaceSkeleton.html +1 -1
  172. data/vendor/local/share/gtk-doc/html/gio/GDBusMethodInvocation.html +1 -1
  173. data/vendor/local/share/gtk-doc/html/gio/GDBusObjectManagerClient.html +2 -4
  174. data/vendor/local/share/gtk-doc/html/gio/GDBusProxy.html +10 -6
  175. data/vendor/local/share/gtk-doc/html/gio/GDBusServer.html +7 -3
  176. data/vendor/local/share/gtk-doc/html/gio/GDataInputStream.html +3 -3
  177. data/vendor/local/share/gtk-doc/html/gio/GFile.html +17 -65
  178. data/vendor/local/share/gtk-doc/html/gio/GFileEnumerator.html +2 -59
  179. data/vendor/local/share/gtk-doc/html/gio/GFileInfo.html +1 -29
  180. data/vendor/local/share/gtk-doc/html/gio/GFileInputStream.html +1 -1
  181. data/vendor/local/share/gtk-doc/html/gio/GInputStream.html +4 -4
  182. data/vendor/local/share/gtk-doc/html/gio/GMemoryOutputStream.html +0 -13
  183. data/vendor/local/share/gtk-doc/html/gio/GMount.html +1 -1
  184. data/vendor/local/share/gtk-doc/html/gio/GProxyAddress.html +2 -2
  185. data/vendor/local/share/gtk-doc/html/gio/GSettings.html +5 -5
  186. data/vendor/local/share/gtk-doc/html/gio/GSimpleAction.html +1 -1
  187. data/vendor/local/share/gtk-doc/html/gio/GSimpleAsyncResult.html +4 -12
  188. data/vendor/local/share/gtk-doc/html/gio/GSocket.html +1 -137
  189. data/vendor/local/share/gtk-doc/html/gio/GTestDBus.html +2 -3
  190. data/vendor/local/share/gtk-doc/html/gio/GTlsConnection.html +1 -1
  191. data/vendor/local/share/gtk-doc/html/gio/GVolume.html +1 -1
  192. data/vendor/local/share/gtk-doc/html/gio/api-index-2-26.html +0 -4
  193. data/vendor/local/share/gtk-doc/html/gio/api-index-deprecated.html +0 -19
  194. data/vendor/local/share/gtk-doc/html/gio/api-index-full.html +0 -180
  195. data/vendor/local/share/gtk-doc/html/gio/async.html +0 -3
  196. data/vendor/local/share/gtk-doc/html/gio/ch01.html +1 -1
  197. data/vendor/local/share/gtk-doc/html/gio/ch02.html +3 -3
  198. data/vendor/local/share/gtk-doc/html/gio/ch03.html +1 -1
  199. data/vendor/local/share/gtk-doc/html/gio/ch29.html +1 -1
  200. data/vendor/local/share/gtk-doc/html/gio/ch30.html +4 -4
  201. data/vendor/local/share/gtk-doc/html/gio/ch30s02.html +2 -2
  202. data/vendor/local/share/gtk-doc/html/gio/ch30s03.html +3 -3
  203. data/vendor/local/share/gtk-doc/html/gio/ch31.html +3 -3
  204. data/vendor/local/share/gtk-doc/html/gio/ch31s02.html +1 -1
  205. data/vendor/local/share/gtk-doc/html/gio/ch31s03.html +1 -1
  206. data/vendor/local/share/gtk-doc/html/gio/ch31s04.html +1 -1
  207. data/vendor/local/share/gtk-doc/html/gio/ch31s05.html +1 -1
  208. data/vendor/local/share/gtk-doc/html/gio/ch31s06.html +2 -2
  209. data/vendor/local/share/gtk-doc/html/gio/ch31s07.html +1 -1
  210. data/vendor/local/share/gtk-doc/html/gio/ch32.html +3 -3
  211. data/vendor/local/share/gtk-doc/html/gio/ch32s02.html +1 -1
  212. data/vendor/local/share/gtk-doc/html/gio/ch32s03.html +1 -1
  213. data/vendor/local/share/gtk-doc/html/gio/ch32s04.html +1 -1
  214. data/vendor/local/share/gtk-doc/html/gio/ch32s05.html +17 -9
  215. data/vendor/local/share/gtk-doc/html/gio/gdbus-codegen.html +11 -11
  216. data/vendor/local/share/gtk-doc/html/gio/gdbus-org.gtk.GDBus.Example.ObjectManager.Animal.html +2 -2
  217. data/vendor/local/share/gtk-doc/html/gio/gdbus.html +6 -6
  218. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Introspection-Data.html +5 -5
  219. data/vendor/local/share/gtk-doc/html/gio/gio-D-Bus-Utilities.html +1 -1
  220. data/vendor/local/share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html +0 -109
  221. data/vendor/local/share/gtk-doc/html/gio/gio-GDBusError.html +1 -1
  222. data/vendor/local/share/gtk-doc/html/gio/gio-GFileAttribute.html +2 -2
  223. data/vendor/local/share/gtk-doc/html/gio/gio-GIOError.html +1 -7
  224. data/vendor/local/share/gtk-doc/html/gio/gio-GIOScheduler.html +12 -29
  225. data/vendor/local/share/gtk-doc/html/gio/gio-GResource.html +1 -1
  226. data/vendor/local/share/gtk-doc/html/gio/gio-Owning-Bus-Names.html +7 -3
  227. data/vendor/local/share/gtk-doc/html/gio/gio-Watching-Bus-Names.html +8 -10
  228. data/vendor/local/share/gtk-doc/html/gio/gio-hierarchy.html +0 -1
  229. data/vendor/local/share/gtk-doc/html/gio/gio-querymodules.html +1 -1
  230. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp2 +11 -64
  231. data/vendor/local/share/gtk-doc/html/gio/glib-compile-resources.html +3 -15
  232. data/vendor/local/share/gtk-doc/html/gio/glib-compile-schemas.html +2 -2
  233. data/vendor/local/share/gtk-doc/html/gio/gresource-tool.html +2 -2
  234. data/vendor/local/share/gtk-doc/html/gio/gsettings-tool.html +2 -2
  235. data/vendor/local/share/gtk-doc/html/gio/highlevel-socket.html +2 -2
  236. data/vendor/local/share/gtk-doc/html/gio/index.html +4 -10
  237. data/vendor/local/share/gtk-doc/html/gio/index.sgml +0 -59
  238. data/vendor/local/share/gtk-doc/html/gio/migrating.html +3 -3
  239. data/vendor/local/share/gtk-doc/html/gio/networking.html +0 -3
  240. data/vendor/local/share/gtk-doc/html/gio/pt01.html +1 -1
  241. data/vendor/local/share/gtk-doc/html/gio/pt02.html +1 -7
  242. data/vendor/local/share/gtk-doc/html/glib/api-index-2-34.html +0 -4
  243. data/vendor/local/share/gtk-doc/html/glib/api-index-full.html +1 -21
  244. data/vendor/local/share/gtk-doc/html/glib/glib-Arrays.html +2 -2
  245. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Arrays.html +1 -1
  246. data/vendor/local/share/gtk-doc/html/glib/glib-Data-Checksums.html +4 -13
  247. data/vendor/local/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html +2 -2
  248. data/vendor/local/share/gtk-doc/html/glib/glib-Deprecated-Thread-APIs.html +11 -7
  249. data/vendor/local/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html +2 -2
  250. data/vendor/local/share/gtk-doc/html/glib/glib-Dynamic-Loading-of-Modules.html +1 -1
  251. data/vendor/local/share/gtk-doc/html/glib/glib-GVariant.html +10 -86
  252. data/vendor/local/share/gtk-doc/html/glib/glib-Hash-Tables.html +46 -5
  253. data/vendor/local/share/gtk-doc/html/glib/glib-IO-Channels.html +7 -11
  254. data/vendor/local/share/gtk-doc/html/glib/glib-Keyed-Data-Lists.html +3 -3
  255. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Slices.html +4 -4
  256. data/vendor/local/share/gtk-doc/html/glib/glib-Message-Logging.html +3 -3
  257. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Utility-Functions.html +34 -27
  258. data/vendor/local/share/gtk-doc/html/glib/glib-Pointer-Arrays.html +1 -1
  259. data/vendor/local/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html +2 -2
  260. data/vendor/local/share/gtk-doc/html/glib/glib-Spawning-Processes.html +2 -2
  261. data/vendor/local/share/gtk-doc/html/glib/glib-Testing.html +2 -23
  262. data/vendor/local/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html +14 -14
  263. data/vendor/local/share/gtk-doc/html/glib/glib-Threads.html +6 -6
  264. data/vendor/local/share/gtk-doc/html/glib/glib-UNIX-specific-utilities-and-integration.html +7 -13
  265. data/vendor/local/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html +5 -9
  266. data/vendor/local/share/gtk-doc/html/glib/glib-Version-Information.html +4 -28
  267. data/vendor/local/share/gtk-doc/html/glib/glib-Warnings-and-Assertions.html +2 -2
  268. data/vendor/local/share/gtk-doc/html/glib/glib-building.html +1 -1
  269. data/vendor/local/share/gtk-doc/html/glib/glib-changes.html +2 -2
  270. data/vendor/local/share/gtk-doc/html/glib/glib-compiling.html +1 -1
  271. data/vendor/local/share/gtk-doc/html/glib/glib-gettextize.html +3 -3
  272. data/vendor/local/share/gtk-doc/html/glib/glib-programming.html +3 -3
  273. data/vendor/local/share/gtk-doc/html/glib/glib-regex-syntax.html +45 -45
  274. data/vendor/local/share/gtk-doc/html/glib/glib-resources.html +3 -3
  275. data/vendor/local/share/gtk-doc/html/glib/glib-running.html +6 -6
  276. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp2 +25 -32
  277. data/vendor/local/share/gtk-doc/html/glib/gtester-report.html +3 -3
  278. data/vendor/local/share/gtk-doc/html/glib/gtester.html +3 -3
  279. data/vendor/local/share/gtk-doc/html/glib/gvariant-format-strings.html +12 -12
  280. data/vendor/local/share/gtk-doc/html/glib/gvariant-text.html +2 -2
  281. data/vendor/local/share/gtk-doc/html/glib/index.html +1 -1
  282. data/vendor/local/share/gtk-doc/html/glib/index.sgml +0 -7
  283. data/vendor/local/share/gtk-doc/html/gobject/api-index-deprecated.html +0 -12
  284. data/vendor/local/share/gtk-doc/html/gobject/api-index-full.html +0 -12
  285. data/vendor/local/share/gtk-doc/html/gobject/ch01s02.html +4 -4
  286. data/vendor/local/share/gtk-doc/html/gobject/chapter-gtype.html +4 -4
  287. data/vendor/local/share/gtk-doc/html/gobject/chapter-intro.html +2 -2
  288. data/vendor/local/share/gtk-doc/html/gobject/chapter-signal.html +8 -8
  289. data/vendor/local/share/gtk-doc/html/gobject/glib-genmarshal.html +6 -6
  290. data/vendor/local/share/gtk-doc/html/gobject/glib-mkenums.html +5 -5
  291. data/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html +0 -22
  292. data/vendor/local/share/gtk-doc/html/gobject/gobject-Generic-values.html +5 -1
  293. data/vendor/local/share/gtk-doc/html/gobject/gobject-Signals.html +32 -6
  294. data/vendor/local/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html +6 -6
  295. data/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html +24 -51
  296. data/vendor/local/share/gtk-doc/html/gobject/gobject-properties.html +4 -4
  297. data/vendor/local/share/gtk-doc/html/gobject/gobject-query.html +3 -3
  298. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp2 +8 -11
  299. data/vendor/local/share/gtk-doc/html/gobject/gtype-conventions.html +2 -2
  300. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-chainup.html +2 -2
  301. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-methods.html +3 -3
  302. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject.html +3 -3
  303. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-properties.html +2 -2
  304. data/vendor/local/share/gtk-doc/html/gobject/howto-signals.html +2 -2
  305. data/vendor/local/share/gtk-doc/html/gobject/index.html +7 -7
  306. data/vendor/local/share/gtk-doc/html/gobject/index.sgml +0 -3
  307. data/vendor/local/share/gtk-doc/html/gobject/pr01.html +1 -1
  308. data/vendor/local/share/gtk-doc/html/gobject/pt01.html +4 -4
  309. data/vendor/local/share/gtk-doc/html/gobject/pt02.html +4 -4
  310. data/vendor/local/share/gtk-doc/html/gobject/pt03.html +1 -1
  311. data/vendor/local/share/gtk-doc/html/gobject/rn01.html +1 -1
  312. data/vendor/local/share/gtk-doc/html/gobject/rn02.html +1 -1
  313. data/vendor/local/share/gtk-doc/html/gobject/signal.html +4 -4
  314. data/vendor/local/share/locale/as/LC_MESSAGES/glib20.mo +0 -0
  315. data/vendor/local/share/locale/cs/LC_MESSAGES/glib-networking.mo +0 -0
  316. data/vendor/local/share/locale/da/LC_MESSAGES/glib20.mo +0 -0
  317. data/vendor/local/share/locale/es/LC_MESSAGES/glib-networking.mo +0 -0
  318. data/vendor/local/share/locale/es/LC_MESSAGES/glib20.mo +0 -0
  319. data/vendor/local/share/locale/gl/LC_MESSAGES/glib20.mo +0 -0
  320. data/vendor/local/share/locale/gu/LC_MESSAGES/glib20.mo +0 -0
  321. data/vendor/local/share/locale/he/LC_MESSAGES/glib-networking.mo +0 -0
  322. data/vendor/local/share/locale/he/LC_MESSAGES/glib20.mo +0 -0
  323. data/vendor/local/share/locale/kn/LC_MESSAGES/glib20.mo +0 -0
  324. data/vendor/local/share/locale/lt/LC_MESSAGES/glib-networking.mo +0 -0
  325. data/vendor/local/share/locale/lt/LC_MESSAGES/glib20.mo +0 -0
  326. data/vendor/local/share/locale/nb/LC_MESSAGES/glib20.mo +0 -0
  327. data/vendor/local/share/locale/or/LC_MESSAGES/glib20.mo +0 -0
  328. data/vendor/local/share/locale/pl/LC_MESSAGES/glib-networking.mo +0 -0
  329. data/vendor/local/share/locale/pl/LC_MESSAGES/glib20.mo +0 -0
  330. data/vendor/local/share/locale/sk/LC_MESSAGES/glib20.mo +0 -0
  331. data/vendor/local/share/locale/sl/LC_MESSAGES/glib20.mo +0 -0
  332. data/vendor/local/share/locale/sr/LC_MESSAGES/glib20.mo +0 -0
  333. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib20.mo +0 -0
  334. data/vendor/local/share/man/man1/gdbus-codegen.1 +1 -1
  335. data/vendor/local/share/man/man1/gdbus.1 +1 -1
  336. data/vendor/local/share/man/man1/gio-querymodules.1 +1 -1
  337. data/vendor/local/share/man/man1/glib-compile-resources.1 +1 -13
  338. data/vendor/local/share/man/man1/glib-compile-schemas.1 +1 -1
  339. data/vendor/local/share/man/man1/glib-genmarshal.1 +1 -1
  340. data/vendor/local/share/man/man1/glib-gettextize.1 +1 -1
  341. data/vendor/local/share/man/man1/glib-mkenums.1 +1 -1
  342. data/vendor/local/share/man/man1/gobject-query.1 +1 -1
  343. data/vendor/local/share/man/man1/gresource.1 +1 -1
  344. data/vendor/local/share/man/man1/gsettings.1 +1 -1
  345. data/vendor/local/share/man/man1/gtester-report.1 +1 -1
  346. data/vendor/local/share/man/man1/gtester.1 +1 -1
  347. metadata +33 -197
  348. data/ext/glib2/rbgobj_fundamental.c +0 -43
  349. data/vendor/local/bin/asn1Coding.exe +0 -0
  350. data/vendor/local/bin/asn1Decoding.exe +0 -0
  351. data/vendor/local/bin/asn1Parser.exe +0 -0
  352. data/vendor/local/bin/dumpsexp.exe +0 -0
  353. data/vendor/local/bin/gpg-error.exe +0 -0
  354. data/vendor/local/bin/hmac256.exe +0 -0
  355. data/vendor/local/bin/libgcrypt-11.dll +0 -0
  356. data/vendor/local/bin/libgcrypt-config +0 -177
  357. data/vendor/local/bin/libgnutls-26.dll +0 -0
  358. data/vendor/local/bin/libgnutls-extra-26.dll +0 -0
  359. data/vendor/local/bin/libgnutls-openssl-26.dll +0 -0
  360. data/vendor/local/bin/libgpg-error-0.dll +0 -0
  361. data/vendor/local/bin/libtasn1-3.dll +0 -0
  362. data/vendor/local/etc/bash_completion.d/gdbus-bash-completion.sh +0 -33
  363. data/vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh +0 -67
  364. data/vendor/local/gnutls.README.txt +0 -6
  365. data/vendor/local/include/gcrypt-module.h +0 -226
  366. data/vendor/local/include/gcrypt.h +0 -1826
  367. data/vendor/local/include/glib-2.0/gio/gnetworking.h +0 -83
  368. data/vendor/local/include/glib-2.0/gio/gtask.h +0 -160
  369. data/vendor/local/include/glib-2.0/glib/gcache.h +0 -69
  370. data/vendor/local/include/glib-2.0/glib/gcompletion.h +0 -81
  371. data/vendor/local/include/glib-2.0/glib/grel.h +0 -101
  372. data/vendor/local/include/gnutls/extra.h +0 -137
  373. data/vendor/local/include/gpg-error.h +0 -651
  374. data/vendor/local/include/libtasn1.h +0 -246
  375. data/vendor/local/lib/gio-2.0.lib +0 -0
  376. data/vendor/local/lib/glib-2.0.lib +0 -0
  377. data/vendor/local/lib/gmodule-2.0.lib +0 -0
  378. data/vendor/local/lib/gobject-2.0.lib +0 -0
  379. data/vendor/local/lib/gthread-2.0.lib +0 -0
  380. data/vendor/local/lib/libgcrypt.def +0 -237
  381. data/vendor/local/lib/libgcrypt.dll.a +0 -0
  382. data/vendor/local/lib/libgnutls-extra.dll.a +0 -0
  383. data/vendor/local/lib/libgpg-error.dll.a +0 -0
  384. data/vendor/local/lib/libtasn1.dll.a +0 -0
  385. data/vendor/local/manifest/glib-dev_2.28.8-1_win32.mft +0 -619
  386. data/vendor/local/manifest/glib_2.28.8-1_win32.mft +0 -103
  387. data/vendor/local/manifest/gnutls-dev_2.4.2-1_win32.mft +0 -593
  388. data/vendor/local/manifest/gnutls_2.4.2-1_win32.mft +0 -8
  389. data/vendor/local/share/aclocal/gpg-error.m4 +0 -65
  390. data/vendor/local/share/aclocal/libgcrypt.m4 +0 -108
  391. data/vendor/local/share/aclocal/libgnutls-extra.m4 +0 -161
  392. data/vendor/local/share/aclocal/libgnutls.m4 +0 -160
  393. data/vendor/local/share/aclocal/libtasn1.m4 +0 -160
  394. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error-codes.lisp +0 -417
  395. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error-package.lisp +0 -64
  396. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error.asd +0 -36
  397. data/vendor/local/share/common-lisp/source/gpg-error/gpg-error.lisp +0 -236
  398. data/vendor/local/share/doc/glib-2.28.8/COPYING +0 -482
  399. data/vendor/local/share/doc/glib-dev-2.28.8/COPYING +0 -482
  400. data/vendor/local/share/glib-2.0/codegen/__init__.pyc +0 -0
  401. data/vendor/local/share/glib-2.0/codegen/__init__.pyo +0 -0
  402. data/vendor/local/share/glib-2.0/codegen/config.pyc +0 -0
  403. data/vendor/local/share/glib-2.0/codegen/config.pyo +0 -0
  404. data/vendor/local/share/glib-2.0/codegen/utils.pyc +0 -0
  405. data/vendor/local/share/glib-2.0/codegen/utils.pyo +0 -0
  406. data/vendor/local/share/gtk-doc/html/gio/GDBusError.html +0 -879
  407. data/vendor/local/share/gtk-doc/html/gio/GTask.html +0 -2296
  408. data/vendor/local/share/gtk-doc/html/gio/ch26.html +0 -75
  409. data/vendor/local/share/gtk-doc/html/gio/ch27.html +0 -217
  410. data/vendor/local/share/gtk-doc/html/gio/ch27s02.html +0 -41
  411. data/vendor/local/share/gtk-doc/html/gio/ch27s03.html +0 -39
  412. data/vendor/local/share/gtk-doc/html/gio/ch28.html +0 -57
  413. data/vendor/local/share/gtk-doc/html/gio/ch28s02.html +0 -59
  414. data/vendor/local/share/gtk-doc/html/gio/ch28s03.html +0 -159
  415. data/vendor/local/share/gtk-doc/html/gio/ch28s04.html +0 -46
  416. data/vendor/local/share/gtk-doc/html/gio/ch28s05.html +0 -48
  417. data/vendor/local/share/gtk-doc/html/gio/ch28s06.html +0 -279
  418. data/vendor/local/share/gtk-doc/html/gio/ch28s07.html +0 -160
  419. data/vendor/local/share/gtk-doc/html/gio/ch29s02.html +0 -130
  420. data/vendor/local/share/gtk-doc/html/gio/ch29s03.html +0 -202
  421. data/vendor/local/share/gtk-doc/html/gio/ch29s04.html +0 -96
  422. data/vendor/local/share/gtk-doc/html/gio/ch29s05.html +0 -823
  423. data/vendor/local/share/gtk-doc/html/gio/ch29s06.html +0 -828
  424. data/vendor/local/share/gtk-doc/html/gio/gio-gnetworking.h.html +0 -91
  425. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp +0 -1956
  426. data/vendor/local/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html +0 -389
  427. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocators.html +0 -137
  428. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Chunks.html +0 -679
  429. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp +0 -2218
  430. data/vendor/local/share/gtk-doc/html/gobject/ch06s03.html +0 -113
  431. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp +0 -766
  432. data/vendor/local/share/info/gcrypt.info +0 -6243
  433. data/vendor/local/share/info/gnutls-certificate-user-use-case.png +0 -0
  434. data/vendor/local/share/info/gnutls-extensions_st.png +0 -0
  435. data/vendor/local/share/info/gnutls-mod_auth_st.png +0 -0
  436. data/vendor/local/share/info/gnutls-objects.png +0 -0
  437. data/vendor/local/share/info/libtasn1.info +0 -2993
  438. data/vendor/local/share/man/man1/asn1Coding.1 +0 -46
  439. data/vendor/local/share/man/man1/asn1Decoding.1 +0 -41
  440. data/vendor/local/share/man/man1/asn1Parser.1 +0 -49
  441. data/vendor/local/share/man/man3/asn1_array2tree.3 +0 -47
  442. data/vendor/local/share/man/man3/asn1_bit_der.3 +0 -39
  443. data/vendor/local/share/man/man3/asn1_check_version.3 +0 -39
  444. data/vendor/local/share/man/man3/asn1_copy_node.3 +0 -39
  445. data/vendor/local/share/man/man3/asn1_create_element.3 +0 -45
  446. data/vendor/local/share/man/man3/asn1_delete_element.3 +0 -39
  447. data/vendor/local/share/man/man3/asn1_delete_structure.3 +0 -37
  448. data/vendor/local/share/man/man3/asn1_der_coding.3 +0 -52
  449. data/vendor/local/share/man/man3/asn1_der_decoding.3 +0 -50
  450. data/vendor/local/share/man/man3/asn1_der_decoding_element.3 +0 -54
  451. data/vendor/local/share/man/man3/asn1_der_decoding_startEnd.3 +0 -58
  452. data/vendor/local/share/man/man3/asn1_expand_any_defined_by.3 +0 -45
  453. data/vendor/local/share/man/man3/asn1_expand_octet_string.3 +0 -51
  454. data/vendor/local/share/man/man3/asn1_find_node.3 +0 -38
  455. data/vendor/local/share/man/man3/asn1_find_structure_from_oid.3 +0 -37
  456. data/vendor/local/share/man/man3/asn1_get_bit_der.3 +0 -43
  457. data/vendor/local/share/man/man3/asn1_get_length_der.3 +0 -38
  458. data/vendor/local/share/man/man3/asn1_get_octet_der.3 +0 -43
  459. data/vendor/local/share/man/man3/asn1_get_tag_der.3 +0 -41
  460. data/vendor/local/share/man/man3/asn1_length_der.3 +0 -36
  461. data/vendor/local/share/man/man3/asn1_number_of_elements.3 +0 -43
  462. data/vendor/local/share/man/man3/asn1_octet_der.3 +0 -37
  463. data/vendor/local/share/man/man3/asn1_parser2array.3 +0 -58
  464. data/vendor/local/share/man/man3/asn1_parser2tree.3 +0 -55
  465. data/vendor/local/share/man/man3/asn1_print_structure.3 +0 -40
  466. data/vendor/local/share/man/man3/asn1_read_tag.3 +0 -46
  467. data/vendor/local/share/man/man3/asn1_read_value.3 +0 -92
  468. data/vendor/local/share/man/man3/asn1_write_value.3 +0 -136
  469. data/vendor/local/share/man/man3/gnutls_certificate_client_set_retrieve_function.3 +0 -58
  470. data/vendor/local/share/man/man3/gnutls_certificate_get_openpgp_keyring.3 +0 -37
  471. data/vendor/local/share/man/man3/gnutls_certificate_get_x509_cas.3 +0 -40
  472. data/vendor/local/share/man/man3/gnutls_certificate_get_x509_crls.3 +0 -40
  473. data/vendor/local/share/man/man3/gnutls_certificate_server_set_retrieve_function.3 +0 -47
  474. data/vendor/local/share/man/man3/gnutls_certificate_verify_peers.3 +0 -44
  475. data/vendor/local/share/man/man3/gnutls_crypto_cipher_register.3 +0 -45
  476. data/vendor/local/share/man/man3/gnutls_crypto_digest_register.3 +0 -45
  477. data/vendor/local/share/man/man3/gnutls_crypto_mac_register.3 +0 -45
  478. data/vendor/local/share/man/man3/gnutls_crypto_rnd_register.3 +0 -43
  479. data/vendor/local/share/man/man3/gnutls_extra_check_version.3 +0 -36
  480. data/vendor/local/share/man/man3/gnutls_free.3 +0 -34
  481. data/vendor/local/share/man/man3/gnutls_global_init_extra.3 +0 -38
  482. data/vendor/local/share/man/man3/gnutls_ia_allocate_client_credentials.3 +0 -42
  483. data/vendor/local/share/man/man3/gnutls_ia_allocate_server_credentials.3 +0 -42
  484. data/vendor/local/share/man/man3/gnutls_ia_enable.3 +0 -53
  485. data/vendor/local/share/man/man3/gnutls_ia_endphase_send.3 +0 -43
  486. data/vendor/local/share/man/man3/gnutls_ia_extract_inner_secret.3 +0 -44
  487. data/vendor/local/share/man/man3/gnutls_ia_free_client_credentials.3 +0 -34
  488. data/vendor/local/share/man/man3/gnutls_ia_free_server_credentials.3 +0 -34
  489. data/vendor/local/share/man/man3/gnutls_ia_generate_challenge.3 +0 -40
  490. data/vendor/local/share/man/man3/gnutls_ia_get_client_avp_ptr.3 +0 -36
  491. data/vendor/local/share/man/man3/gnutls_ia_get_server_avp_ptr.3 +0 -36
  492. data/vendor/local/share/man/man3/gnutls_ia_handshake.3 +0 -36
  493. data/vendor/local/share/man/man3/gnutls_ia_handshake_p.3 +0 -37
  494. data/vendor/local/share/man/man3/gnutls_ia_permute_inner_secret.3 +0 -43
  495. data/vendor/local/share/man/man3/gnutls_ia_recv.3 +0 -57
  496. data/vendor/local/share/man/man3/gnutls_ia_send.3 +0 -56
  497. data/vendor/local/share/man/man3/gnutls_ia_set_client_avp_function.3 +0 -61
  498. data/vendor/local/share/man/man3/gnutls_ia_set_client_avp_ptr.3 +0 -36
  499. data/vendor/local/share/man/man3/gnutls_ia_set_server_avp_function.3 +0 -68
  500. data/vendor/local/share/man/man3/gnutls_ia_set_server_avp_ptr.3 +0 -36
  501. data/vendor/local/share/man/man3/gnutls_ia_verify_endphase.3 +0 -45
  502. data/vendor/local/share/man/man3/gnutls_malloc.3 +0 -37
  503. data/vendor/local/share/man/man3/gnutls_openpgp_privkey_get_subkey_expiration_time.3 +0 -40
  504. data/vendor/local/share/man/man3/gnutls_oprfi_enable_client.3 +0 -42
  505. data/vendor/local/share/man/man3/gnutls_oprfi_enable_server.3 +0 -49
  506. data/vendor/local/share/man/man3/gnutls_psk_netconf_derive_key.3 +0 -44
  507. data/vendor/local/share/man/man3/gnutls_session_get_client_random.3 +0 -40
  508. data/vendor/local/share/man/man3/gnutls_session_get_master_secret.3 +0 -43
  509. data/vendor/local/share/man/man3/gnutls_session_get_server_random.3 +0 -40
  510. data/vendor/local/share/man/man3/gnutls_sign_algorithm_get_name.3 +0 -35
  511. data/vendor/local/share/man/man3/gnutls_transport_set_global_errno.3 +0 -47
  512. data/vendor/local/share/man/man3/gnutls_transport_set_lowat.3 +0 -40
  513. data/vendor/local/share/man/man3/gnutls_x509_privkey_verify_data.3 +0 -43
  514. data/vendor/local/share/man/man3/libtasn1_perror.3 +0 -32
  515. data/vendor/local/share/man/man3/libtasn1_strerror.3 +0 -35
  516. data/vendor/local/src/dieterv/packaging/glib_2.28.8-1_win32.log +0 -2919
  517. data/vendor/local/src/dieterv/packaging/glib_2.28.8-1_win32.sh +0 -157
@@ -1,2296 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <title>GTask</title>
6
- <meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7
- <link rel="home" href="index.html" title="GIO Reference Manual">
8
- <link rel="up" href="async.html" title="Asynchronous I/O">
9
- <link rel="prev" href="GAsyncResult.html" title="GAsyncResult">
10
- <link rel="next" href="gio-GIOScheduler.html" title="GIOScheduler">
11
- <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12
- <link rel="stylesheet" href="style.css" type="text/css">
13
- </head>
14
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
- <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16
- <tr valign="middle">
17
- <td><a accesskey="p" href="GAsyncResult.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
- <td><a accesskey="u" href="async.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
- <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
- <th width="100%" align="center">GIO Reference Manual</th>
21
- <td><a accesskey="n" href="gio-GIOScheduler.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22
- </tr>
23
- <tr><td colspan="5" class="shortcuts">
24
- <a href="#GTask.synopsis" class="shortcut">Top</a>
25
-  | 
26
- <a href="#GTask.description" class="shortcut">Description</a>
27
-  | 
28
- <a href="#GTask.object-hierarchy" class="shortcut">Object Hierarchy</a>
29
-  | 
30
- <a href="#GTask.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
31
- </td></tr>
32
- </table>
33
- <div class="refentry">
34
- <a name="GTask"></a><div class="titlepage"></div>
35
- <div class="refnamediv"><table width="100%"><tr>
36
- <td valign="top">
37
- <h2><span class="refentrytitle"><a name="GTask.top_of_page"></a>GTask</span></h2>
38
- <p>GTask — Cancellable synchronous or asynchronous task and result</p>
39
- </td>
40
- <td valign="top" align="right"></td>
41
- </tr></table></div>
42
- <div class="refsynopsisdiv">
43
- <a name="GTask.synopsis"></a><h2>Synopsis</h2>
44
- <pre class="synopsis">
45
- #include &lt;gio/gio.h&gt;
46
-
47
- <a class="link" href="GTask.html#GTask-struct" title="GTask">GTask</a>;
48
- <a class="link" href="GTask.html" title="GTask"><span class="returnvalue">GTask</span></a> * <a class="link" href="GTask.html#g-task-new" title="g_task_new ()">g_task_new</a> (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
49
- <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
50
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
51
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>);
52
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-set-task-data" title="g_task_set_task_data ()">g_task_set_task_data</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
53
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> task_data</code></em>,
54
- <em class="parameter"><code><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> task_data_destroy</code></em>);
55
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-set-priority" title="g_task_set_priority ()">g_task_set_priority</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
56
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> priority</code></em>);
57
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-set-check-cancellable" title="g_task_set_check_cancellable ()">g_task_set_check_cancellable</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
58
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> check_cancellable</code></em>);
59
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()">g_task_set_return_on_cancel</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
60
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> return_on_cancel</code></em>);
61
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-set-source-tag" title="g_task_set_source_tag ()">g_task_set_source_tag</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
62
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);
63
-
64
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-report-error" title="g_task_report_error ()">g_task_report_error</a> (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
65
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
66
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
67
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>,
68
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);
69
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-report-new-error" title="g_task_report_new_error ()">g_task_report_new_error</a> (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
70
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
71
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
72
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>,
73
- <em class="parameter"><code><a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
74
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
75
- <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
76
- <em class="parameter"><code>...</code></em>);
77
-
78
- <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GTask.html#g-task-get-task-data" title="g_task_get_task_data ()">g_task_get_task_data</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
79
- <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> <a class="link" href="GTask.html#g-task-get-priority" title="g_task_get_priority ()">g_task_get_priority</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
80
- <a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> * <a class="link" href="GTask.html#g-task-get-cancellable" title="g_task_get_cancellable ()">g_task_get_cancellable</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
81
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-get-check-cancellable" title="g_task_get_check_cancellable ()">g_task_get_check_cancellable</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
82
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-get-return-on-cancel" title="g_task_get_return_on_cancel ()">g_task_get_return_on_cancel</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
83
- <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="returnvalue">GMainContext</span></a> * <a class="link" href="GTask.html#g-task-get-context" title="g_task_get_context ()">g_task_get_context</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
84
- <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GTask.html#g-task-get-source-object" title="g_task_get_source_object ()">g_task_get_source_object</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
85
- <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GTask.html#g-task-get-source-tag" title="g_task_get_source_tag ()">g_task_get_source_tag</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
86
-
87
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-return-boolean" title="g_task_return_boolean ()">g_task_return_boolean</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
88
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> result</code></em>);
89
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-return-int" title="g_task_return_int ()">g_task_return_int</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
90
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="type">gssize</span></a> result</code></em>);
91
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()">g_task_return_pointer</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
92
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> result</code></em>,
93
- <em class="parameter"><code><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> result_destroy</code></em>);
94
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()">g_task_return_error</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
95
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);
96
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-return-new-error" title="g_task_return_new_error ()">g_task_return_new_error</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
97
- <em class="parameter"><code><a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
98
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
99
- <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
100
- <em class="parameter"><code>...</code></em>);
101
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()">g_task_return_error_if_cancelled</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
102
-
103
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-propagate-boolean" title="g_task_propagate_boolean ()">g_task_propagate_boolean</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
104
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
105
- <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a> <a class="link" href="GTask.html#g-task-propagate-int" title="g_task_propagate_int ()">g_task_propagate_int</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
106
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
107
- <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()">g_task_propagate_pointer</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
108
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
109
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-had-error" title="g_task_had_error ()">g_task_had_error</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);
110
-
111
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()">g_task_run_in_thread</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
112
- <em class="parameter"><code><a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> task_func</code></em>);
113
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()">g_task_run_in_thread_sync</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
114
- <em class="parameter"><code><a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> task_func</code></em>);
115
- <span class="returnvalue">void</span> (<a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()">*GTaskThreadFunc</a>) (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
116
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
117
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> task_data</code></em>,
118
- <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);
119
- <span class="returnvalue">void</span> <a class="link" href="GTask.html#g-task-attach-source" title="g_task_attach_source ()">g_task_attach_source</a> (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
120
- <em class="parameter"><code><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> *source</code></em>,
121
- <em class="parameter"><code><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSourceFunc"><span class="type">GSourceFunc</span></a> callback</code></em>);
122
-
123
- <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GTask.html#g-task-is-valid" title="g_task_is_valid ()">g_task_is_valid</a> (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> result</code></em>,
124
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>);
125
- </pre>
126
- </div>
127
- <div class="refsect1">
128
- <a name="GTask.object-hierarchy"></a><h2>Object Hierarchy</h2>
129
- <pre class="synopsis">
130
- <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
131
- +----GTask
132
- </pre>
133
- </div>
134
- <div class="refsect1">
135
- <a name="GTask.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
136
- <p>
137
- GTask implements
138
- <a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a>.</p>
139
- </div>
140
- <div class="refsect1">
141
- <a name="GTask.description"></a><h2>Description</h2>
142
- <p>
143
- </p>
144
- <p>
145
- A <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> represents and manages a cancellable "task".
146
- </p>
147
- <p>
148
- </p>
149
- <div class="refsect2">
150
- <a name="idp15755616"></a><h3>Asynchronous operations</h3>
151
- <p>
152
- The most common usage of <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> is as a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>, to
153
- manage data during an asynchronous operation. You call
154
- <a class="link" href="GTask.html#g-task-new" title="g_task_new ()"><code class="function">g_task_new()</code></a> in the "start" method, followed by
155
- <a class="link" href="GTask.html#g-task-set-task-data" title="g_task_set_task_data ()"><code class="function">g_task_set_task_data()</code></a> and the like if you need to keep some
156
- additional data associated with the task, and then pass the
157
- task object around through your asynchronous operation.
158
- Eventually, you will call a method such as
159
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> or <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a>, which will
160
- save the value you give it and then invoke the task's callback
161
- function (waiting until the next next iteration of the main
162
- loop first, if necessary). The caller will pass the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> back
163
- to the operation's finish function (as a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>), and
164
- you can use <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a> or the like to extract
165
- the return value.
166
- </p>
167
- <div class="example">
168
- <a name="gtask-async"></a><p class="title"><b>Example 1. GTask as a GAsyncResult</b></p>
169
- <div class="example-contents">
170
- <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
171
- <tbody>
172
- <tr>
173
- <td class="listing_lines" align="right"><pre>1
174
- 2
175
- 3
176
- 4
177
- 5
178
- 6
179
- 7
180
- 8
181
- 9
182
- 10
183
- 11
184
- 12
185
- 13
186
- 14
187
- 15
188
- 16
189
- 17
190
- 18
191
- 19
192
- 20
193
- 21
194
- 22
195
- 23
196
- 24
197
- 25
198
- 26
199
- 27
200
- 28
201
- 29
202
- 30
203
- 31
204
- 32
205
- 33
206
- 34
207
- 35
208
- 36
209
- 37
210
- 38
211
- 39
212
- 40
213
- 41
214
- 42
215
- 43
216
- 44
217
- 45
218
- 46
219
- 47
220
- 48
221
- 49
222
- 50
223
- 51
224
- 52
225
- 53
226
- 54
227
- 55
228
- 56
229
- 57
230
- 58
231
- 59
232
- 60
233
- 61
234
- 62
235
- 63
236
- 64
237
- 65
238
- 66
239
- 67
240
- 68
241
- 69
242
- 70
243
- 71
244
- 72
245
- 73
246
- 74
247
- 75
248
- 76
249
- 77
250
- 78
251
- 79
252
- 80
253
- 81
254
- 82
255
- 83
256
- 84
257
- 85
258
- 86
259
- 87
260
- 88
261
- 89
262
- 90
263
- 91</pre></td>
264
- <td class="listing_code"><pre class="programlisting"><span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span><span class="normal"> </span><span class="cbracket">{</span>
265
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">;</span>
266
- <span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">;</span>
267
- <span class="cbracket">}</span><span class="normal"> DecorationData</span><span class="symbol">;</span>
268
-
269
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
270
- <span class="function">decoration_data_free</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">DecorationData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">decoration</span><span class="symbol">)</span>
271
- <span class="cbracket">{</span>
272
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">decoration</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">);</span>
273
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-free">g_slice_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">DecorationData</span><span class="symbol">,</span><span class="normal"> decoration</span><span class="symbol">);</span>
274
- <span class="cbracket">}</span>
275
-
276
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
277
- <span class="function">baked_cb</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">,</span>
278
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
279
- <span class="cbracket">{</span>
280
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>
281
- <span class="normal"> </span><span class="usertype">DecorationData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">decoration </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-get-task-data">g_task_get_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
282
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
283
-
284
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake </span><span class="symbol">==</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
285
- <span class="normal"> </span><span class="cbracket">{</span>
286
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-new-error">g_task_return_new_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR_NO_FLOUR</span><span class="symbol">,</span>
287
- <span class="normal"> </span><span class="string">"Go to the supermarket"</span><span class="symbol">);</span>
288
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
289
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
290
- <span class="normal"> </span><span class="cbracket">}</span>
291
-
292
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function">cake_decorate</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">,</span><span class="normal"> decoration</span><span class="symbol">-&gt;</span><span class="normal">frosting</span><span class="symbol">,</span><span class="normal"> decoration</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">))</span>
293
- <span class="normal"> </span><span class="cbracket">{</span>
294
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">);</span>
295
- <span class="normal"> </span><span class="comment">/* g_task_return_error() takes ownership of error */</span>
296
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-error">g_task_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
297
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
298
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
299
- <span class="normal"> </span><span class="cbracket">}</span>
300
-
301
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-pointer">g_task_return_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> cake</span><span class="symbol">,</span><span class="normal"> <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="symbol">);</span>
302
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
303
- <span class="cbracket">}</span>
304
-
305
- <span class="type">void</span>
306
- <span class="function">baker_bake_cake_async</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
307
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">,</span>
308
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">,</span>
309
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">,</span>
310
- <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
311
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
312
- <span class="normal"> </span><span class="usertype">GAsyncReadyCallback</span><span class="normal"> callback</span><span class="symbol">,</span>
313
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
314
- <span class="cbracket">{</span>
315
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">;</span>
316
- <span class="normal"> </span><span class="usertype">DecorationData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">decoration</span><span class="symbol">;</span>
317
- <span class="normal"> </span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">;</span>
318
-
319
- <span class="normal"> task </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-new">g_task_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> callback</span><span class="symbol">,</span><span class="normal"> user_data</span><span class="symbol">);</span>
320
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">radius </span><span class="symbol">&lt;</span><span class="normal"> </span><span class="number">3</span><span class="symbol">)</span>
321
- <span class="normal"> </span><span class="cbracket">{</span>
322
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-new-error">g_task_return_new_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR_TOO_SMALL</span><span class="symbol">,</span>
323
- <span class="normal"> </span><span class="string">"%ucm radius cakes are silly"</span><span class="symbol">,</span>
324
- <span class="normal"> radius</span><span class="symbol">);</span>
325
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
326
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
327
- <span class="normal"> </span><span class="cbracket">}</span>
328
-
329
- <span class="normal"> cake </span><span class="symbol">=</span><span class="normal"> </span><span class="function">_baker_get_cached_cake</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> radius</span><span class="symbol">,</span><span class="normal"> flavor</span><span class="symbol">,</span><span class="normal"> frosting</span><span class="symbol">,</span><span class="normal"> message</span><span class="symbol">);</span>
330
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake </span><span class="symbol">!=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
331
- <span class="normal"> </span><span class="cbracket">{</span>
332
- <span class="normal"> </span><span class="comment">/* _baker_get_cached_cake() returns a reffed cake */</span>
333
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-pointer">g_task_return_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake</span><span class="symbol">,</span><span class="normal"> <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="symbol">);</span>
334
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
335
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
336
- <span class="normal"> </span><span class="cbracket">}</span>
337
-
338
- <span class="normal"> decoration </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-new">g_slice_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">DecorationData</span><span class="symbol">);</span>
339
- <span class="normal"> decoration</span><span class="symbol">-&gt;</span><span class="normal">frosting </span><span class="symbol">=</span><span class="normal"> frosting</span><span class="symbol">;</span>
340
- <span class="normal"> decoration</span><span class="symbol">-&gt;</span><span class="normal">message </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">);</span>
341
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-task-data">g_task_set_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> decoration</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a></span><span class="symbol">)</span><span class="normal"> decoration_data_free</span><span class="symbol">);</span>
342
-
343
- <span class="normal"> </span><span class="function">_baker_begin_cake</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> radius</span><span class="symbol">,</span><span class="normal"> flavor</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> baked_cb</span><span class="symbol">,</span><span class="normal"> task</span><span class="symbol">);</span>
344
- <span class="cbracket">}</span>
345
-
346
- <span class="normal">Cake </span><span class="symbol">*</span>
347
- <span class="function">baker_bake_cake_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
348
- <span class="normal"> </span><span class="usertype">GAsyncResult</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">,</span>
349
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
350
- <span class="cbracket">{</span>
351
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Warnings-and-Assertions.html#g-return-val-if-fail">g_return_val_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-is-valid">g_task_is_valid</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> self</span><span class="symbol">),</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
352
-
353
- <span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-propagate-pointer">g_task_propagate_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_TASK</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">),</span><span class="normal"> error</span><span class="symbol">);</span>
354
- <span class="cbracket">}</span></pre></td>
355
- </tr>
356
- </tbody>
357
- </table>
358
- </div>
359
-
360
- </div>
361
- <br class="example-break">
362
- </div>
363
- <p>
364
- </p>
365
- <hr>
366
- <div class="refsect2">
367
- <a name="idp15771424"></a><h3>Chained asynchronous operations</h3>
368
- <p>
369
- <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> also tries to simplify asynchronous operations that
370
- internally chain together several smaller asynchronous
371
- operations. <a class="link" href="GTask.html#g-task-get-cancellable" title="g_task_get_cancellable ()"><code class="function">g_task_get_cancellable()</code></a>, <a class="link" href="GTask.html#g-task-get-context" title="g_task_get_context ()"><code class="function">g_task_get_context()</code></a>, and
372
- <a class="link" href="GTask.html#g-task-get-priority" title="g_task_get_priority ()"><code class="function">g_task_get_priority()</code></a> allow you to get back the task's
373
- <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>, and <a class="link" href="GAsyncResult.html#io-priority">I/O priority</a> when starting a new
374
- subtask, so you don't have to keep track of them yourself.
375
- <a class="link" href="GTask.html#g-task-attach-source" title="g_task_attach_source ()"><code class="function">g_task_attach_source()</code></a> simplifies the case of waiting for a
376
- source to fire (automatically using the correct <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>
377
- and priority).
378
- </p>
379
- <div class="example">
380
- <a name="gtask-chained"></a><p class="title"><b>Example 2. Chained asynchronous operations</b></p>
381
- <div class="example-contents">
382
- <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
383
- <tbody>
384
- <tr>
385
- <td class="listing_lines" align="right"><pre>1
386
- 2
387
- 3
388
- 4
389
- 5
390
- 6
391
- 7
392
- 8
393
- 9
394
- 10
395
- 11
396
- 12
397
- 13
398
- 14
399
- 15
400
- 16
401
- 17
402
- 18
403
- 19
404
- 20
405
- 21
406
- 22
407
- 23
408
- 24
409
- 25
410
- 26
411
- 27
412
- 28
413
- 29
414
- 30
415
- 31
416
- 32
417
- 33
418
- 34
419
- 35
420
- 36
421
- 37
422
- 38
423
- 39
424
- 40
425
- 41
426
- 42
427
- 43
428
- 44
429
- 45
430
- 46
431
- 47
432
- 48
433
- 49
434
- 50
435
- 51
436
- 52
437
- 53
438
- 54
439
- 55
440
- 56
441
- 57
442
- 58
443
- 59
444
- 60
445
- 61
446
- 62
447
- 63
448
- 64
449
- 65
450
- 66
451
- 67
452
- 68
453
- 69
454
- 70
455
- 71
456
- 72
457
- 73
458
- 74
459
- 75
460
- 76
461
- 77
462
- 78
463
- 79
464
- 80
465
- 81
466
- 82
467
- 83
468
- 84
469
- 85
470
- 86
471
- 87
472
- 88
473
- 89
474
- 90
475
- 91
476
- 92
477
- 93
478
- 94
479
- 95
480
- 96
481
- 97
482
- 98
483
- 99
484
- 100
485
- 101
486
- 102
487
- 103
488
- 104
489
- 105
490
- 106
491
- 107
492
- 108
493
- 109
494
- 110
495
- 111
496
- 112
497
- 113
498
- 114
499
- 115
500
- 116
501
- 117
502
- 118
503
- 119
504
- 120
505
- 121
506
- 122
507
- 123
508
- 124</pre></td>
509
- <td class="listing_code"><pre class="programlisting"><span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span><span class="normal"> </span><span class="cbracket">{</span>
510
- <span class="normal"> </span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">;</span>
511
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">;</span>
512
- <span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">;</span>
513
- <span class="cbracket">}</span><span class="normal"> BakingData</span><span class="symbol">;</span>
514
-
515
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
516
- <span class="function">decoration_data_free</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">BakingData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">bd</span><span class="symbol">)</span>
517
- <span class="cbracket">{</span>
518
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">bd</span><span class="symbol">-&gt;</span><span class="normal">cake</span><span class="symbol">)</span>
519
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">bd</span><span class="symbol">-&gt;</span><span class="normal">cake</span><span class="symbol">);</span>
520
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">bd</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">);</span>
521
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-free">g_slice_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">BakingData</span><span class="symbol">,</span><span class="normal"> bd</span><span class="symbol">);</span>
522
- <span class="cbracket">}</span>
523
-
524
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
525
- <span class="function">decorated_cb</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">,</span>
526
- <span class="normal"> </span><span class="usertype">GAsyncResult</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">,</span>
527
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
528
- <span class="cbracket">{</span>
529
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>
530
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
531
-
532
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function">cake_decorate_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">,</span><span class="normal"> result</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">))</span>
533
- <span class="normal"> </span><span class="cbracket">{</span>
534
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">);</span>
535
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-error">g_task_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
536
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
537
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
538
- <span class="normal"> </span><span class="cbracket">}</span>
539
-
540
- <span class="normal"> </span><span class="comment">/* baking_data_free() will drop its ref on the cake, so</span>
541
- <span class="comment"> * we have to take another here to give to the caller.</span>
542
- <span class="comment"> */</span>
543
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-pointer">g_task_return_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">),</span><span class="normal"> <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="symbol">);</span>
544
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
545
- <span class="cbracket">}</span>
546
-
547
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
548
- <span class="function">decorator_ready</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
549
- <span class="cbracket">{</span>
550
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>
551
- <span class="normal"> </span><span class="usertype">BakingData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">bd </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-get-task-data">g_task_get_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
552
-
553
- <span class="normal"> </span><span class="function">cake_decorate_async</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">bd</span><span class="symbol">-&gt;</span><span class="normal">cake</span><span class="symbol">,</span><span class="normal"> bd</span><span class="symbol">-&gt;</span><span class="normal">frosting</span><span class="symbol">,</span><span class="normal"> bd</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">,</span>
554
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-get-cancellable">g_task_get_cancellable</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">),</span>
555
- <span class="normal"> decorated_cb</span><span class="symbol">,</span><span class="normal"> task</span><span class="symbol">);</span>
556
- <span class="cbracket">}</span>
557
-
558
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
559
- <span class="function">baked_cb</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">,</span>
560
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
561
- <span class="cbracket">{</span>
562
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>
563
- <span class="normal"> </span><span class="usertype">BakingData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">bd </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-get-task-data">g_task_get_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
564
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
565
-
566
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake </span><span class="symbol">==</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
567
- <span class="normal"> </span><span class="cbracket">{</span>
568
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-new-error">g_task_return_new_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR</span><span class="symbol">,</span><span class="normal"> BAKER_ERROR_NO_FLOUR</span><span class="symbol">,</span>
569
- <span class="normal"> </span><span class="string">"Go to the supermarket"</span><span class="symbol">);</span>
570
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
571
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
572
- <span class="normal"> </span><span class="cbracket">}</span>
573
-
574
- <span class="normal"> bd</span><span class="symbol">-&gt;</span><span class="normal">cake </span><span class="symbol">=</span><span class="normal"> cake</span><span class="symbol">;</span>
575
-
576
- <span class="normal"> </span><span class="comment">/* Bail out now if the user has already cancelled */</span>
577
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-return-error-if-cancelled">g_task_return_error_if_cancelled</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-get-cancellable">g_task_get_cancellable</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">)))</span>
578
- <span class="normal"> </span><span class="cbracket">{</span>
579
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
580
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
581
- <span class="normal"> </span><span class="cbracket">}</span>
582
-
583
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function">cake_decorator_available</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">))</span>
584
- <span class="normal"> </span><span class="function">decorator_ready</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
585
- <span class="normal"> </span><span class="keyword">else</span>
586
- <span class="normal"> </span><span class="cbracket">{</span>
587
- <span class="normal"> </span><span class="usertype">GSource</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">source</span><span class="symbol">;</span>
588
-
589
- <span class="normal"> source </span><span class="symbol">=</span><span class="normal"> </span><span class="function">cake_decorator_wait_source_new</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">);</span>
590
- <span class="normal"> </span><span class="comment">/* Attach @source to @task's GMainContext and have it call</span>
591
- <span class="comment"> * decorator_ready() when it is ready.</span>
592
- <span class="comment"> */</span>
593
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-attach-source">g_task_attach_source</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> source</span><span class="symbol">,</span>
594
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">decorator_ready</span><span class="symbol">));</span>
595
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-The-Main-Event-Loop.html#g-source-unref">g_source_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">source</span><span class="symbol">);</span>
596
- <span class="normal"> </span><span class="cbracket">}</span>
597
- <span class="cbracket">}</span>
598
-
599
- <span class="type">void</span>
600
- <span class="function">baker_bake_cake_async</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
601
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">,</span>
602
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">,</span>
603
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">,</span>
604
- <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
605
- <span class="normal"> </span><span class="usertype">gint</span><span class="normal"> priority</span><span class="symbol">,</span>
606
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
607
- <span class="normal"> </span><span class="usertype">GAsyncReadyCallback</span><span class="normal"> callback</span><span class="symbol">,</span>
608
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
609
- <span class="cbracket">{</span>
610
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">;</span>
611
- <span class="normal"> </span><span class="usertype">BakingData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">bd</span><span class="symbol">;</span>
612
-
613
- <span class="normal"> task </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-new">g_task_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> callback</span><span class="symbol">,</span><span class="normal"> user_data</span><span class="symbol">);</span>
614
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-priority">g_task_set_priority</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> priority</span><span class="symbol">);</span>
615
-
616
- <span class="normal"> bd </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-new0">g_slice_new0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">BakingData</span><span class="symbol">);</span>
617
- <span class="normal"> bd</span><span class="symbol">-&gt;</span><span class="normal">frosting </span><span class="symbol">=</span><span class="normal"> frosting</span><span class="symbol">;</span>
618
- <span class="normal"> bd</span><span class="symbol">-&gt;</span><span class="normal">message </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">);</span>
619
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-task-data">g_task_set_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> bd</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a></span><span class="symbol">)</span><span class="normal"> baking_data_free</span><span class="symbol">);</span>
620
-
621
- <span class="normal"> </span><span class="function">_baker_begin_cake</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> radius</span><span class="symbol">,</span><span class="normal"> flavor</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> baked_cb</span><span class="symbol">,</span><span class="normal"> task</span><span class="symbol">);</span>
622
- <span class="cbracket">}</span>
623
-
624
- <span class="normal">Cake </span><span class="symbol">*</span>
625
- <span class="function">baker_bake_cake_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
626
- <span class="normal"> </span><span class="usertype">GAsyncResult</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">,</span>
627
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
628
- <span class="cbracket">{</span>
629
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Warnings-and-Assertions.html#g-return-val-if-fail">g_return_val_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-is-valid">g_task_is_valid</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> self</span><span class="symbol">),</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
630
-
631
- <span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-propagate-pointer">g_task_propagate_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_TASK</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">),</span><span class="normal"> error</span><span class="symbol">);</span>
632
- <span class="cbracket">}</span></pre></td>
633
- </tr>
634
- </tbody>
635
- </table>
636
- </div>
637
-
638
- </div>
639
- <br class="example-break">
640
- </div>
641
- <p>
642
- </p>
643
- <hr>
644
- <div class="refsect2">
645
- <a name="idp15787520"></a><h3>Asynchronous operations from synchronous ones</h3>
646
- <p>
647
- You can use <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> to turn a synchronous
648
- operation into an asynchronous one, by running it in a thread
649
- which will then dispatch the result back to the caller's
650
- <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> when it completes.
651
- </p>
652
- <div class="example">
653
- <a name="gtask-run-in-thread"></a><p class="title"><b>Example 3. <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a></b></p>
654
- <div class="example-contents">
655
- <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
656
- <tbody>
657
- <tr>
658
- <td class="listing_lines" align="right"><pre>1
659
- 2
660
- 3
661
- 4
662
- 5
663
- 6
664
- 7
665
- 8
666
- 9
667
- 10
668
- 11
669
- 12
670
- 13
671
- 14
672
- 15
673
- 16
674
- 17
675
- 18
676
- 19
677
- 20
678
- 21
679
- 22
680
- 23
681
- 24
682
- 25
683
- 26
684
- 27
685
- 28
686
- 29
687
- 30
688
- 31
689
- 32
690
- 33
691
- 34
692
- 35
693
- 36
694
- 37
695
- 38
696
- 39
697
- 40
698
- 41
699
- 42
700
- 43
701
- 44
702
- 45
703
- 46
704
- 47
705
- 48
706
- 49
707
- 50
708
- 51
709
- 52
710
- 53
711
- 54
712
- 55
713
- 56
714
- 57
715
- 58
716
- 59
717
- 60
718
- 61
719
- 62
720
- 63
721
- 64
722
- 65
723
- 66</pre></td>
724
- <td class="listing_code"><pre class="programlisting"><span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span><span class="normal"> </span><span class="cbracket">{</span>
725
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">;</span>
726
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">;</span>
727
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">;</span>
728
- <span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">;</span>
729
- <span class="cbracket">}</span><span class="normal"> CakeData</span><span class="symbol">;</span>
730
-
731
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
732
- <span class="function">cake_data_free</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data</span><span class="symbol">)</span>
733
- <span class="cbracket">{</span>
734
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake_data</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">);</span>
735
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-free">g_slice_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">CakeData</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">);</span>
736
- <span class="cbracket">}</span>
737
-
738
- <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
739
- <span class="function">bake_cake_thread</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">,</span>
740
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> source_object</span><span class="symbol">,</span>
741
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> task_data</span><span class="symbol">,</span>
742
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">)</span>
743
- <span class="cbracket">{</span>
744
- <span class="normal"> </span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self </span><span class="symbol">=</span><span class="normal"> source_object</span><span class="symbol">;</span>
745
- <span class="normal"> </span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data </span><span class="symbol">=</span><span class="normal"> task_data</span><span class="symbol">;</span>
746
- <span class="normal"> </span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">;</span>
747
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
748
-
749
- <span class="normal"> cake </span><span class="symbol">=</span><span class="normal"> </span><span class="function">bake_cake</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">baker</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">radius</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">flavor</span><span class="symbol">,</span>
750
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">frosting</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">,</span>
751
- <span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
752
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cake</span><span class="symbol">)</span>
753
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-pointer">g_task_return_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake</span><span class="symbol">,</span><span class="normal"> <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="symbol">);</span>
754
- <span class="normal"> </span><span class="keyword">else</span>
755
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-error">g_task_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
756
- <span class="cbracket">}</span>
757
-
758
- <span class="type">void</span>
759
- <span class="function">baker_bake_cake_async</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
760
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">,</span>
761
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">,</span>
762
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">,</span>
763
- <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
764
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
765
- <span class="normal"> </span><span class="usertype">GAsyncReadyCallback</span><span class="normal"> callback</span><span class="symbol">,</span>
766
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
767
- <span class="cbracket">{</span>
768
- <span class="normal"> </span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data</span><span class="symbol">;</span>
769
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">;</span>
770
-
771
- <span class="normal"> cake_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-new">g_slice_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">CakeData</span><span class="symbol">);</span>
772
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">radius </span><span class="symbol">=</span><span class="normal"> radius</span><span class="symbol">;</span>
773
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">flavor </span><span class="symbol">=</span><span class="normal"> flavor</span><span class="symbol">;</span>
774
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">frosting </span><span class="symbol">=</span><span class="normal"> frosting</span><span class="symbol">;</span>
775
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">message </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">);</span>
776
- <span class="normal"> task </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-new">g_task_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> callback</span><span class="symbol">,</span><span class="normal"> user_data</span><span class="symbol">);</span>
777
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-task-data">g_task_set_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a></span><span class="symbol">)</span><span class="normal"> cake_data_free</span><span class="symbol">);</span>
778
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-run-in-thread">g_task_run_in_thread</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> bake_cake_thread</span><span class="symbol">);</span>
779
- <span class="cbracket">}</span>
780
-
781
- <span class="normal">Cake </span><span class="symbol">*</span>
782
- <span class="function">baker_bake_cake_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
783
- <span class="normal"> </span><span class="usertype">GAsyncResult</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">,</span>
784
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
785
- <span class="cbracket">{</span>
786
- <span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Warnings-and-Assertions.html#g-return-val-if-fail">g_return_val_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-is-valid">g_task_is_valid</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">,</span><span class="normal"> self</span><span class="symbol">),</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
787
-
788
- <span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-propagate-pointer">g_task_propagate_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_TASK</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">result</span><span class="symbol">),</span><span class="normal"> error</span><span class="symbol">);</span>
789
- <span class="cbracket">}</span></pre></td>
790
- </tr>
791
- </tbody>
792
- </table>
793
- </div>
794
-
795
- </div>
796
- <br class="example-break">
797
- </div>
798
- <p>
799
- </p>
800
- <hr>
801
- <div class="refsect2">
802
- <a name="idp15795888"></a><h3>Adding cancellability to uncancellable tasks</h3>
803
- <p>
804
- Finally, <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> and <a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()"><code class="function">g_task_run_in_thread_sync()</code></a>
805
- can be used to turn an uncancellable operation into a
806
- cancellable one. If you call <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a>,
807
- passing <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then if the task's <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> is cancelled,
808
- it will return control back to the caller immediately, while
809
- allowing the task thread to continue running in the background
810
- (and simply discarding its result when it finally does finish).
811
- Provided that the task thread is careful about how it uses
812
- locks and other externally-visible resources, this allows you
813
- to make "GLib-friendly" asynchronous and cancellable
814
- synchronous variants of blocking APIs.
815
- </p>
816
- <div class="example">
817
- <a name="gtask-cancellable"></a><p class="title"><b>Example 4. <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a></b></p>
818
- <div class="example-contents">
819
- <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
820
- <tbody>
821
- <tr>
822
- <td class="listing_lines" align="right"><pre>1
823
- 2
824
- 3
825
- 4
826
- 5
827
- 6
828
- 7
829
- 8
830
- 9
831
- 10
832
- 11
833
- 12
834
- 13
835
- 14
836
- 15
837
- 16
838
- 17
839
- 18
840
- 19
841
- 20
842
- 21
843
- 22
844
- 23
845
- 24
846
- 25
847
- 26
848
- 27
849
- 28
850
- 29
851
- 30
852
- 31
853
- 32
854
- 33
855
- 34
856
- 35
857
- 36
858
- 37
859
- 38
860
- 39
861
- 40
862
- 41
863
- 42
864
- 43
865
- 44
866
- 45
867
- 46
868
- 47
869
- 48
870
- 49
871
- 50
872
- 51
873
- 52
874
- 53
875
- 54
876
- 55
877
- 56
878
- 57
879
- 58
880
- 59
881
- 60
882
- 61
883
- 62
884
- 63
885
- 64
886
- 65
887
- 66
888
- 67
889
- 68
890
- 69
891
- 70
892
- 71
893
- 72
894
- 73
895
- 74
896
- 75
897
- 76
898
- 77
899
- 78
900
- 79
901
- 80
902
- 81
903
- 82
904
- 83
905
- 84
906
- 85
907
- 86
908
- 87
909
- 88</pre></td>
910
- <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
911
- <span class="function">bake_cake_thread</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">,</span>
912
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> source_object</span><span class="symbol">,</span>
913
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> task_data</span><span class="symbol">,</span>
914
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">)</span>
915
- <span class="cbracket">{</span>
916
- <span class="normal"> </span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self </span><span class="symbol">=</span><span class="normal"> source_object</span><span class="symbol">;</span>
917
- <span class="normal"> </span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data </span><span class="symbol">=</span><span class="normal"> task_data</span><span class="symbol">;</span>
918
- <span class="normal"> </span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">;</span>
919
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
920
-
921
- <span class="normal"> cake </span><span class="symbol">=</span><span class="normal"> </span><span class="function">bake_cake</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">baker</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">radius</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">flavor</span><span class="symbol">,</span>
922
- <span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">frosting</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">,</span>
923
- <span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
924
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">)</span>
925
- <span class="normal"> </span><span class="cbracket">{</span>
926
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-error">g_task_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
927
- <span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
928
- <span class="normal"> </span><span class="cbracket">}</span>
929
-
930
- <span class="normal"> </span><span class="comment">/* If the task has already been cancelled, then we don't</span>
931
- <span class="comment"> * want to add the cake to the cake cache. Likewise, we don't</span>
932
- <span class="comment"> * want to have the task get cancelled in the middle of</span>
933
- <span class="comment"> * updating the cache. g_task_set_return_on_cancel() will</span>
934
- <span class="comment"> * return %TRUE here if it managed to disable return-on-cancel,</span>
935
- <span class="comment"> * or %FALSE if the task was cancelled before it could.</span>
936
- <span class="comment"> */</span>
937
- <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GTask.html#g-task-set-return-on-cancel">g_task_set_return_on_cancel</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">))</span>
938
- <span class="normal"> </span><span class="cbracket">{</span>
939
- <span class="normal"> </span><span class="comment">/* If the caller cancels at this point, their</span>
940
- <span class="comment"> * GAsyncReadyCallback won't be invoked until we return,</span>
941
- <span class="comment"> * so we don't have to worry that this code will run at</span>
942
- <span class="comment"> * the same time as that code does. But if there were</span>
943
- <span class="comment"> * other functions that might look at the cake cache,</span>
944
- <span class="comment"> * then we'd probably need a GMutex here as well.</span>
945
- <span class="comment"> */</span>
946
- <span class="normal"> </span><span class="function">baker_add_cake_to_cache</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">baker</span><span class="symbol">,</span><span class="normal"> cake</span><span class="symbol">);</span>
947
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-return-pointer">g_task_return_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake</span><span class="symbol">,</span><span class="normal"> <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="symbol">);</span>
948
- <span class="normal"> </span><span class="cbracket">}</span>
949
- <span class="cbracket">}</span>
950
-
951
- <span class="type">void</span>
952
- <span class="function">baker_bake_cake_async</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
953
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">,</span>
954
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">,</span>
955
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">,</span>
956
- <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
957
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
958
- <span class="normal"> </span><span class="usertype">GAsyncReadyCallback</span><span class="normal"> callback</span><span class="symbol">,</span>
959
- <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
960
- <span class="cbracket">{</span>
961
- <span class="normal"> </span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data</span><span class="symbol">;</span>
962
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">;</span>
963
-
964
- <span class="normal"> cake_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-new">g_slice_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">CakeData</span><span class="symbol">);</span>
965
- <span class="normal"> </span><span class="comment">/* ... */</span>
966
-
967
- <span class="normal"> task </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-new">g_task_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> callback</span><span class="symbol">,</span><span class="normal"> user_data</span><span class="symbol">);</span>
968
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-task-data">g_task_set_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a></span><span class="symbol">)</span><span class="normal"> cake_data_free</span><span class="symbol">);</span>
969
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-return-on-cancel">g_task_set_return_on_cancel</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">);</span>
970
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-run-in-thread">g_task_run_in_thread</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> bake_cake_thread</span><span class="symbol">);</span>
971
- <span class="cbracket">}</span>
972
-
973
- <span class="normal">Cake </span><span class="symbol">*</span>
974
- <span class="function">baker_bake_cake_sync</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">Baker</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">self</span><span class="symbol">,</span>
975
- <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> radius</span><span class="symbol">,</span>
976
- <span class="normal"> </span><span class="usertype">CakeFlavor</span><span class="normal"> flavor</span><span class="symbol">,</span>
977
- <span class="normal"> </span><span class="usertype">CakeFrostingType</span><span class="normal"> frosting</span><span class="symbol">,</span>
978
- <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
979
- <span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
980
- <span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
981
- <span class="cbracket">{</span>
982
- <span class="normal"> </span><span class="usertype">CakeData</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake_data</span><span class="symbol">;</span>
983
- <span class="normal"> </span><span class="usertype">GTask</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">task</span><span class="symbol">;</span>
984
- <span class="normal"> </span><span class="usertype">Cake</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cake</span><span class="symbol">;</span>
985
-
986
- <span class="normal"> cake_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-Memory-Slices.html#g-slice-new">g_slice_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">CakeData</span><span class="symbol">);</span>
987
- <span class="normal"> </span><span class="comment">/* ... */</span>
988
-
989
- <span class="normal"> task </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-new">g_task_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">self</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
990
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-task-data">g_task_set_task_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> cake_data</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a></span><span class="symbol">)</span><span class="normal"> cake_data_free</span><span class="symbol">);</span>
991
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-set-return-on-cancel">g_task_set_return_on_cancel</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">);</span>
992
- <span class="normal"> </span><span class="function"><a href="GTask.html#g-task-run-in-thread-sync">g_task_run_in_thread_sync</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> bake_cake_thread</span><span class="symbol">);</span>
993
-
994
- <span class="normal"> cake </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GTask.html#g-task-propagate-pointer">g_task_propagate_pointer</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
995
- <span class="normal"> </span><span class="function"><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">task</span><span class="symbol">);</span>
996
- <span class="normal"> </span><span class="keyword">return</span><span class="normal"> cake</span><span class="symbol">;</span>
997
- <span class="cbracket">}</span></pre></td>
998
- </tr>
999
- </tbody>
1000
- </table>
1001
- </div>
1002
-
1003
- </div>
1004
- <br class="example-break">
1005
- </div>
1006
- <p>
1007
- </p>
1008
- <hr>
1009
- <div class="refsect2">
1010
- <a name="idp15809456"></a><h3>Porting from <code class="literal">GSimpleAsyncResult</code>
1011
- </h3>
1012
- <p>
1013
- <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>'s API attempts to be simpler than <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>'s
1014
- in several ways:
1015
- </p>
1016
- <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1017
- <li class="listitem"><p>
1018
- You can save task-specific data with <a class="link" href="GTask.html#g-task-set-task-data" title="g_task_set_task_data ()"><code class="function">g_task_set_task_data()</code></a>, and
1019
- retrieve it later with <a class="link" href="GTask.html#g-task-get-task-data" title="g_task_get_task_data ()"><code class="function">g_task_get_task_data()</code></a>. This replaces the
1020
- abuse of <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gpointer" title="g_simple_async_result_set_op_res_gpointer ()"><code class="function">g_simple_async_result_set_op_res_gpointer()</code></a> for the same
1021
- purpose with <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.
1022
- </p></li>
1023
- <li class="listitem"><p>
1024
- In addition to the task data, <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> also keeps track of the
1025
- <a class="link" href="GAsyncResult.html#io-priority">priority</a>, <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, and
1026
- <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> associated with the task, so tasks that consist of
1027
- a chain of simpler asynchronous operations will have easy access
1028
- to those values when starting each sub-task.
1029
- </p></li>
1030
- <li class="listitem"><p>
1031
- <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()"><code class="function">g_task_return_error_if_cancelled()</code></a> provides simplified
1032
- handling for cancellation. In addition, cancellation
1033
- overrides any other <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> return value by default, like
1034
- <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> does when
1035
- <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-check-cancellable" title="g_simple_async_result_set_check_cancellable ()"><code class="function">g_simple_async_result_set_check_cancellable()</code></a> is called.
1036
- (You can use <a class="link" href="GTask.html#g-task-set-check-cancellable" title="g_task_set_check_cancellable ()"><code class="function">g_task_set_check_cancellable()</code></a> to turn off that
1037
- behavior.) On the other hand, <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a>
1038
- guarantees that it will always run your
1039
- <code class="literal">task_func</code>, even if the task's <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>
1040
- is already cancelled before the task gets a chance to run;
1041
- you can start your <code class="literal">task_func</code> with a
1042
- <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()"><code class="function">g_task_return_error_if_cancelled()</code></a> check if you need the
1043
- old behavior.
1044
- </p></li>
1045
- <li class="listitem"><p>
1046
- The "return" methods (eg, <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a>)
1047
- automatically cause the task to be "completed" as well, and
1048
- there is no need to worry about the "complete" vs "complete
1049
- in idle" distinction. (<a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> automatically figures out
1050
- whether the task's callback can be invoked directly, or
1051
- if it needs to be sent to another <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>, or delayed
1052
- until the next iteration of the current <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>.)
1053
- </p></li>
1054
- <li class="listitem"><p>
1055
- The "finish" functions for <span class="type">GTask-based</span> operations are generally
1056
- much simpler than <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> ones, normally consisting
1057
- of only a single call to <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a> or the like.
1058
- Since <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a> "steals" the return value from
1059
- the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>, it is not necessary to juggle pointers around to
1060
- prevent it from being freed twice.
1061
- </p></li>
1062
- <li class="listitem"><p>
1063
- With <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>, it was common to call
1064
- <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error" title="g_simple_async_result_propagate_error ()"><code class="function">g_simple_async_result_propagate_error()</code></a> from the
1065
- <code class="literal"><code class="function">_finish()</code></code> wrapper function, and have
1066
- virtual method implementations only deal with successful
1067
- returns. This behavior is deprecated, because it makes it
1068
- difficult for a subclass to chain to a parent class's async
1069
- methods. Instead, the wrapper function should just be a
1070
- simple wrapper, and the virtual method should call an
1071
- appropriate <code class="literal">g_task_propagate_</code> function.
1072
- Note that wrapper methods can now use
1073
- <a class="link" href="GAsyncResult.html#g-async-result-legacy-propagate-error" title="g_async_result_legacy_propagate_error ()"><code class="function">g_async_result_legacy_propagate_error()</code></a> to do old-style
1074
- <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> error-returning behavior, and
1075
- <a class="link" href="GAsyncResult.html#g-async-result-is-tagged" title="g_async_result_is_tagged ()"><code class="function">g_async_result_is_tagged()</code></a> to check if a result is tagged as
1076
- having come from the <code class="literal"><a class="link" href="async.html" title="Asynchronous I/O"><code class="function">_async()</code></a></code> wrapper
1077
- function (for "short-circuit" results, such as when passing
1078
- 0 to <a class="link" href="GInputStream.html#g-input-stream-read-async" title="g_input_stream_read_async ()"><code class="function">g_input_stream_read_async()</code></a>).
1079
- </p></li>
1080
- </ul></div>
1081
- </div>
1082
- <p>
1083
- </p>
1084
- </div>
1085
- <div class="refsect1">
1086
- <a name="GTask.details"></a><h2>Details</h2>
1087
- <div class="refsect2">
1088
- <a name="GTask-struct"></a><h3>GTask</h3>
1089
- <pre class="programlisting">typedef struct _GTask GTask;</pre>
1090
- <p>
1091
- The opaque object representing a synchronous or asynchronous task
1092
- and its result.
1093
- </p>
1094
- </div>
1095
- <hr>
1096
- <div class="refsect2">
1097
- <a name="g-task-new"></a><h3>g_task_new ()</h3>
1098
- <pre class="programlisting"><a class="link" href="GTask.html" title="GTask"><span class="returnvalue">GTask</span></a> * g_task_new (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
1099
- <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1100
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1101
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>);</pre>
1102
- <p>
1103
- Creates a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> acting on <em class="parameter"><code>source_object</code></em>, which will eventually be
1104
- used to invoke <em class="parameter"><code>callback</code></em> in the current <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
1105
- context</GTKDOCLINK>.
1106
- </p>
1107
- <p>
1108
- Call this in the "start" method of your asynchronous method, and
1109
- pass the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> around throughout the asynchronous operation. You
1110
- can use <a class="link" href="GTask.html#g-task-set-task-data" title="g_task_set_task_data ()"><code class="function">g_task_set_task_data()</code></a> to attach task-specific data to the
1111
- object, which you can retrieve later via <a class="link" href="GTask.html#g-task-get-task-data" title="g_task_get_task_data ()"><code class="function">g_task_get_task_data()</code></a>.
1112
- </p>
1113
- <p>
1114
- By default, if <em class="parameter"><code>cancellable</code></em> is cancelled, then the return value of
1115
- the task will always be <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>, even if the task had
1116
- already completed before the cancellation. This allows for
1117
- simplified handling in cases where cancellation may imply that
1118
- other objects that the task depends on have been destroyed. If you
1119
- do not want this behavior, you can use
1120
- <a class="link" href="GTask.html#g-task-set-check-cancellable" title="g_task_set_check_cancellable ()"><code class="function">g_task_set_check_cancellable()</code></a> to change it.
1121
- </p>
1122
- <div class="variablelist"><table border="0" class="variablelist">
1123
- <colgroup>
1124
- <col align="left" valign="top">
1125
- <col>
1126
- </colgroup>
1127
- <tbody>
1128
- <tr>
1129
- <td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td>
1130
- <td>the <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> that owns
1131
- this task, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
1132
- </td>
1133
- </tr>
1134
- <tr>
1135
- <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1136
- <td>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1137
- </td>
1138
- </tr>
1139
- <tr>
1140
- <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
1141
- <td>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
1142
- </td>
1143
- </tr>
1144
- <tr>
1145
- <td><p><span class="term"><em class="parameter"><code>callback_data</code></em> :</span></p></td>
1146
- <td>user data passed to <em class="parameter"><code>callback</code></em>. <span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span>
1147
- </td>
1148
- </tr>
1149
- <tr>
1150
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1151
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1152
- </tr>
1153
- </tbody>
1154
- </table></div>
1155
- <p class="since">Since 2.36</p>
1156
- </div>
1157
- <hr>
1158
- <div class="refsect2">
1159
- <a name="g-task-set-task-data"></a><h3>g_task_set_task_data ()</h3>
1160
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_set_task_data (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1161
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> task_data</code></em>,
1162
- <em class="parameter"><code><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> task_data_destroy</code></em>);</pre>
1163
- <p>
1164
- Sets <em class="parameter"><code>task</code></em>'s task data (freeing the existing task data, if any).
1165
- </p>
1166
- <div class="variablelist"><table border="0" class="variablelist">
1167
- <colgroup>
1168
- <col align="left" valign="top">
1169
- <col>
1170
- </colgroup>
1171
- <tbody>
1172
- <tr>
1173
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1174
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1175
- </td>
1176
- </tr>
1177
- <tr>
1178
- <td><p><span class="term"><em class="parameter"><code>task_data</code></em> :</span></p></td>
1179
- <td>task-specific data. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1180
- </td>
1181
- </tr>
1182
- <tr>
1183
- <td><p><span class="term"><em class="parameter"><code>task_data_destroy</code></em> :</span></p></td>
1184
- <td>
1185
- <a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>task_data</code></em>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1186
- </td>
1187
- </tr>
1188
- </tbody>
1189
- </table></div>
1190
- <p class="since">Since 2.36</p>
1191
- </div>
1192
- <hr>
1193
- <div class="refsect2">
1194
- <a name="g-task-set-priority"></a><h3>g_task_set_priority ()</h3>
1195
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_set_priority (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1196
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> priority</code></em>);</pre>
1197
- <p>
1198
- Sets <em class="parameter"><code>task</code></em>'s priority. If you do not call this, it will default to
1199
- <a href="./../glib/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT:CAPS"><code class="literal">G_PRIORITY_DEFAULT</code></a>.
1200
- </p>
1201
- <p>
1202
- This will affect the priority of <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSources</span></a> created with
1203
- <a class="link" href="GTask.html#g-task-attach-source" title="g_task_attach_source ()"><code class="function">g_task_attach_source()</code></a> and the scheduling of tasks run in threads,
1204
- and can also be explicitly retrieved later via
1205
- <a class="link" href="GTask.html#g-task-get-priority" title="g_task_get_priority ()"><code class="function">g_task_get_priority()</code></a>.
1206
- </p>
1207
- <div class="variablelist"><table border="0" class="variablelist">
1208
- <colgroup>
1209
- <col align="left" valign="top">
1210
- <col>
1211
- </colgroup>
1212
- <tbody>
1213
- <tr>
1214
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1215
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1216
- </td>
1217
- </tr>
1218
- <tr>
1219
- <td><p><span class="term"><em class="parameter"><code>priority</code></em> :</span></p></td>
1220
- <td>the <a class="link" href="GAsyncResult.html#io-priority">priority</a>
1221
- of the request.</td>
1222
- </tr>
1223
- </tbody>
1224
- </table></div>
1225
- <p class="since">Since 2.36</p>
1226
- </div>
1227
- <hr>
1228
- <div class="refsect2">
1229
- <a name="g-task-set-check-cancellable"></a><h3>g_task_set_check_cancellable ()</h3>
1230
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_set_check_cancellable (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1231
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> check_cancellable</code></em>);</pre>
1232
- <p>
1233
- Sets or clears <em class="parameter"><code>task</code></em>'s check-cancellable flag. If this is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>
1234
- (the default), then <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a>, etc, and
1235
- <a class="link" href="GTask.html#g-task-had-error" title="g_task_had_error ()"><code class="function">g_task_had_error()</code></a> will check the task's <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> first, and
1236
- if it has been cancelled, then they will consider the task to have
1237
- returned an "Operation was cancelled" error
1238
- (<a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>), regardless of any other error or return
1239
- value the task may have had.
1240
- </p>
1241
- <p>
1242
- If <em class="parameter"><code>check_cancellable</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> will not check the
1243
- cancellable itself, and it is up to <em class="parameter"><code>task</code></em>'s owner to do this (eg,
1244
- via <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()"><code class="function">g_task_return_error_if_cancelled()</code></a>).
1245
- </p>
1246
- <p>
1247
- If you are using <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> as well, then
1248
- you must leave check-cancellable set <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
1249
- </p>
1250
- <div class="variablelist"><table border="0" class="variablelist">
1251
- <colgroup>
1252
- <col align="left" valign="top">
1253
- <col>
1254
- </colgroup>
1255
- <tbody>
1256
- <tr>
1257
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1258
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1259
- </td>
1260
- </tr>
1261
- <tr>
1262
- <td><p><span class="term"><em class="parameter"><code>check_cancellable</code></em> :</span></p></td>
1263
- <td>whether <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> will check the state of
1264
- its <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> for you.</td>
1265
- </tr>
1266
- </tbody>
1267
- </table></div>
1268
- <p class="since">Since 2.36</p>
1269
- </div>
1270
- <hr>
1271
- <div class="refsect2">
1272
- <a name="g-task-set-return-on-cancel"></a><h3>g_task_set_return_on_cancel ()</h3>
1273
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_set_return_on_cancel (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1274
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> return_on_cancel</code></em>);</pre>
1275
- <p>
1276
- Sets or clears <em class="parameter"><code>task</code></em>'s return-on-cancel flag. This is only
1277
- meaningful for tasks run via <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> or
1278
- <a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()"><code class="function">g_task_run_in_thread_sync()</code></a>.
1279
- </p>
1280
- <p>
1281
- If <em class="parameter"><code>return_on_cancel</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then cancelling <em class="parameter"><code>task</code></em>'s
1282
- <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> will immediately cause it to return, as though the
1283
- task's <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> had called
1284
- <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()"><code class="function">g_task_return_error_if_cancelled()</code></a> and then returned.
1285
- </p>
1286
- <p>
1287
- This allows you to create a cancellable wrapper around an
1288
- uninterruptable function. The <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> just needs to be
1289
- careful that it does not modify any externally-visible state after
1290
- it has been cancelled. To do that, the thread should call
1291
- <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> again to (atomically) set
1292
- return-on-cancel <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> before making externally-visible changes;
1293
- if the task gets cancelled before the return-on-cancel flag could
1294
- be changed, <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> will indicate this by
1295
- returning <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.
1296
- </p>
1297
- <p>
1298
- You can disable and re-enable this flag multiple times if you wish.
1299
- If the task's <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> is cancelled while return-on-cancel is
1300
- <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then calling <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> to set it <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>
1301
- again will cause the task to be cancelled at that point.
1302
- </p>
1303
- <p>
1304
- If the task's <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> is already cancelled before you call
1305
- <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a>/<a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()"><code class="function">g_task_run_in_thread_sync()</code></a>, then the
1306
- <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> will still be run (for consistency), but the task
1307
- will also be completed right away.
1308
- </p>
1309
- <div class="variablelist"><table border="0" class="variablelist">
1310
- <colgroup>
1311
- <col align="left" valign="top">
1312
- <col>
1313
- </colgroup>
1314
- <tbody>
1315
- <tr>
1316
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1317
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1318
- </td>
1319
- </tr>
1320
- <tr>
1321
- <td><p><span class="term"><em class="parameter"><code>return_on_cancel</code></em> :</span></p></td>
1322
- <td>whether the task returns automatically when
1323
- it is cancelled.</td>
1324
- </tr>
1325
- <tr>
1326
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1327
- <td>
1328
- <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>task</code></em>'s return-on-cancel flag was changed to
1329
- match <em class="parameter"><code>return_on_cancel</code></em>. <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>task</code></em> has already been
1330
- cancelled.</td>
1331
- </tr>
1332
- </tbody>
1333
- </table></div>
1334
- <p class="since">Since 2.36</p>
1335
- </div>
1336
- <hr>
1337
- <div class="refsect2">
1338
- <a name="g-task-set-source-tag"></a><h3>g_task_set_source_tag ()</h3>
1339
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_set_source_tag (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1340
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);</pre>
1341
- <p>
1342
- Sets <em class="parameter"><code>task</code></em>'s source tag. You can use this to tag a task return
1343
- value with a particular pointer (usually a pointer to the function
1344
- doing the tagging) and then later check it using
1345
- <a class="link" href="GTask.html#g-task-get-source-tag" title="g_task_get_source_tag ()"><code class="function">g_task_get_source_tag()</code></a> (or <a class="link" href="GAsyncResult.html#g-async-result-is-tagged" title="g_async_result_is_tagged ()"><code class="function">g_async_result_is_tagged()</code></a>) in the
1346
- task's "finish" function, to figure out if the response came from a
1347
- particular place.
1348
- </p>
1349
- <div class="variablelist"><table border="0" class="variablelist">
1350
- <colgroup>
1351
- <col align="left" valign="top">
1352
- <col>
1353
- </colgroup>
1354
- <tbody>
1355
- <tr>
1356
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1357
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1358
- </td>
1359
- </tr>
1360
- <tr>
1361
- <td><p><span class="term"><em class="parameter"><code>source_tag</code></em> :</span></p></td>
1362
- <td>an opaque pointer indicating the source of this task</td>
1363
- </tr>
1364
- </tbody>
1365
- </table></div>
1366
- <p class="since">Since 2.36</p>
1367
- </div>
1368
- <hr>
1369
- <div class="refsect2">
1370
- <a name="g-task-report-error"></a><h3>g_task_report_error ()</h3>
1371
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_report_error (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
1372
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1373
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
1374
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>,
1375
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1376
- <p>
1377
- Creates a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and then immediately calls <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a>
1378
- on it. Use this in the wrapper function of an asynchronous method
1379
- when you want to avoid even calling the virtual method. You can
1380
- then use <a class="link" href="GAsyncResult.html#g-async-result-is-tagged" title="g_async_result_is_tagged ()"><code class="function">g_async_result_is_tagged()</code></a> in the finish method wrapper to
1381
- check if the result there is tagged as having been created by the
1382
- wrapper method, and deal with it appropriately if so.
1383
- </p>
1384
- <p>
1385
- See also <a class="link" href="GTask.html#g-task-report-new-error" title="g_task_report_new_error ()"><code class="function">g_task_report_new_error()</code></a>.
1386
- </p>
1387
- <div class="variablelist"><table border="0" class="variablelist">
1388
- <colgroup>
1389
- <col align="left" valign="top">
1390
- <col>
1391
- </colgroup>
1392
- <tbody>
1393
- <tr>
1394
- <td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td>
1395
- <td>the <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> that owns
1396
- this task, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
1397
- </td>
1398
- </tr>
1399
- <tr>
1400
- <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
1401
- <td>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
1402
- </td>
1403
- </tr>
1404
- <tr>
1405
- <td><p><span class="term"><em class="parameter"><code>callback_data</code></em> :</span></p></td>
1406
- <td>user data passed to <em class="parameter"><code>callback</code></em>. <span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span>
1407
- </td>
1408
- </tr>
1409
- <tr>
1410
- <td><p><span class="term"><em class="parameter"><code>source_tag</code></em> :</span></p></td>
1411
- <td>an opaque pointer indicating the source of this task</td>
1412
- </tr>
1413
- <tr>
1414
- <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1415
- <td>error to report. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1416
- </td>
1417
- </tr>
1418
- </tbody>
1419
- </table></div>
1420
- <p class="since">Since 2.36</p>
1421
- </div>
1422
- <hr>
1423
- <div class="refsect2">
1424
- <a name="g-task-report-new-error"></a><h3>g_task_report_new_error ()</h3>
1425
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_report_new_error (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
1426
- <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1427
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
1428
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>,
1429
- <em class="parameter"><code><a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
1430
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
1431
- <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
1432
- <em class="parameter"><code>...</code></em>);</pre>
1433
- <p>
1434
- Creates a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and then immediately calls
1435
- <a class="link" href="GTask.html#g-task-return-new-error" title="g_task_return_new_error ()"><code class="function">g_task_return_new_error()</code></a> on it. Use this in the wrapper function
1436
- of an asynchronous method when you want to avoid even calling the
1437
- virtual method. You can then use <a class="link" href="GAsyncResult.html#g-async-result-is-tagged" title="g_async_result_is_tagged ()"><code class="function">g_async_result_is_tagged()</code></a> in the
1438
- finish method wrapper to check if the result there is tagged as
1439
- having been created by the wrapper method, and deal with it
1440
- appropriately if so.
1441
- </p>
1442
- <p>
1443
- See also <a class="link" href="GTask.html#g-task-report-error" title="g_task_report_error ()"><code class="function">g_task_report_error()</code></a>.
1444
- </p>
1445
- <div class="variablelist"><table border="0" class="variablelist">
1446
- <colgroup>
1447
- <col align="left" valign="top">
1448
- <col>
1449
- </colgroup>
1450
- <tbody>
1451
- <tr>
1452
- <td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td>
1453
- <td>the <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> that owns
1454
- this task, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
1455
- </td>
1456
- </tr>
1457
- <tr>
1458
- <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
1459
- <td>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. <span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span>
1460
- </td>
1461
- </tr>
1462
- <tr>
1463
- <td><p><span class="term"><em class="parameter"><code>callback_data</code></em> :</span></p></td>
1464
- <td>user data passed to <em class="parameter"><code>callback</code></em>. <span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span>
1465
- </td>
1466
- </tr>
1467
- <tr>
1468
- <td><p><span class="term"><em class="parameter"><code>source_tag</code></em> :</span></p></td>
1469
- <td>an opaque pointer indicating the source of this task</td>
1470
- </tr>
1471
- <tr>
1472
- <td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
1473
- <td>a <a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.</td>
1474
- </tr>
1475
- <tr>
1476
- <td><p><span class="term"><em class="parameter"><code>code</code></em> :</span></p></td>
1477
- <td>an error code.</td>
1478
- </tr>
1479
- <tr>
1480
- <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
1481
- <td>a string with format characters.</td>
1482
- </tr>
1483
- <tr>
1484
- <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1485
- <td>a list of values to insert into <em class="parameter"><code>format</code></em>.</td>
1486
- </tr>
1487
- </tbody>
1488
- </table></div>
1489
- <p class="since">Since 2.36</p>
1490
- </div>
1491
- <hr>
1492
- <div class="refsect2">
1493
- <a name="g-task-get-task-data"></a><h3>g_task_get_task_data ()</h3>
1494
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> g_task_get_task_data (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1495
- <p>
1496
- Gets <em class="parameter"><code>task</code></em>'s <code class="literal">task_data</code>.
1497
- </p>
1498
- <div class="variablelist"><table border="0" class="variablelist">
1499
- <colgroup>
1500
- <col align="left" valign="top">
1501
- <col>
1502
- </colgroup>
1503
- <tbody>
1504
- <tr>
1505
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1506
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1507
- </td>
1508
- </tr>
1509
- <tr>
1510
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1511
- <td>
1512
- <em class="parameter"><code>task</code></em>'s <code class="literal">task_data</code>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
1513
- </td>
1514
- </tr>
1515
- </tbody>
1516
- </table></div>
1517
- <p class="since">Since 2.36</p>
1518
- </div>
1519
- <hr>
1520
- <div class="refsect2">
1521
- <a name="g-task-get-priority"></a><h3>g_task_get_priority ()</h3>
1522
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> g_task_get_priority (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1523
- <p>
1524
- Gets <em class="parameter"><code>task</code></em>'s priority
1525
- </p>
1526
- <div class="variablelist"><table border="0" class="variablelist">
1527
- <colgroup>
1528
- <col align="left" valign="top">
1529
- <col>
1530
- </colgroup>
1531
- <tbody>
1532
- <tr>
1533
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1534
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1535
- </td>
1536
- </tr>
1537
- <tr>
1538
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1539
- <td>
1540
- <em class="parameter"><code>task</code></em>'s priority</td>
1541
- </tr>
1542
- </tbody>
1543
- </table></div>
1544
- <p class="since">Since 2.36</p>
1545
- </div>
1546
- <hr>
1547
- <div class="refsect2">
1548
- <a name="g-task-get-cancellable"></a><h3>g_task_get_cancellable ()</h3>
1549
- <pre class="programlisting"><a class="link" href="GCancellable.html" title="GCancellable"><span class="returnvalue">GCancellable</span></a> * g_task_get_cancellable (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1550
- <p>
1551
- Gets <em class="parameter"><code>task</code></em>'s <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>
1552
- </p>
1553
- <div class="variablelist"><table border="0" class="variablelist">
1554
- <colgroup>
1555
- <col align="left" valign="top">
1556
- <col>
1557
- </colgroup>
1558
- <tbody>
1559
- <tr>
1560
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1561
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1562
- </td>
1563
- </tr>
1564
- <tr>
1565
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1566
- <td>
1567
- <em class="parameter"><code>task</code></em>'s <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
1568
- </td>
1569
- </tr>
1570
- </tbody>
1571
- </table></div>
1572
- <p class="since">Since 2.36</p>
1573
- </div>
1574
- <hr>
1575
- <div class="refsect2">
1576
- <a name="g-task-get-check-cancellable"></a><h3>g_task_get_check_cancellable ()</h3>
1577
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_get_check_cancellable (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1578
- <p>
1579
- Gets <em class="parameter"><code>task</code></em>'s check-cancellable flag. See
1580
- <a class="link" href="GTask.html#g-task-set-check-cancellable" title="g_task_set_check_cancellable ()"><code class="function">g_task_set_check_cancellable()</code></a> for more details.
1581
- </p>
1582
- <div class="variablelist"><table border="0" class="variablelist">
1583
- <colgroup>
1584
- <col align="left" valign="top">
1585
- <col>
1586
- </colgroup>
1587
- <tbody><tr>
1588
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1589
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1590
- </td>
1591
- </tr></tbody>
1592
- </table></div>
1593
- <p class="since">Since 2.36</p>
1594
- </div>
1595
- <hr>
1596
- <div class="refsect2">
1597
- <a name="g-task-get-return-on-cancel"></a><h3>g_task_get_return_on_cancel ()</h3>
1598
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_get_return_on_cancel (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1599
- <p>
1600
- Gets <em class="parameter"><code>task</code></em>'s return-on-cancel flag. See
1601
- <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> for more details.
1602
- </p>
1603
- <div class="variablelist"><table border="0" class="variablelist">
1604
- <colgroup>
1605
- <col align="left" valign="top">
1606
- <col>
1607
- </colgroup>
1608
- <tbody><tr>
1609
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1610
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1611
- </td>
1612
- </tr></tbody>
1613
- </table></div>
1614
- <p class="since">Since 2.36</p>
1615
- </div>
1616
- <hr>
1617
- <div class="refsect2">
1618
- <a name="g-task-get-context"></a><h3>g_task_get_context ()</h3>
1619
- <pre class="programlisting"><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="returnvalue">GMainContext</span></a> * g_task_get_context (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1620
- <p>
1621
- Gets the <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> that <em class="parameter"><code>task</code></em> will return its result in (that
1622
- is, the context that was the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
1623
- context</GTKDOCLINK> at the point when <em class="parameter"><code>task</code></em> was created).
1624
- </p>
1625
- <p>
1626
- This will always return a non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> value, even if the task's
1627
- context is the default <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>.
1628
- </p>
1629
- <div class="variablelist"><table border="0" class="variablelist">
1630
- <colgroup>
1631
- <col align="left" valign="top">
1632
- <col>
1633
- </colgroup>
1634
- <tbody>
1635
- <tr>
1636
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1637
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1638
- </td>
1639
- </tr>
1640
- <tr>
1641
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1642
- <td>
1643
- <em class="parameter"><code>task</code></em>'s <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
1644
- </td>
1645
- </tr>
1646
- </tbody>
1647
- </table></div>
1648
- <p class="since">Since 2.36</p>
1649
- </div>
1650
- <hr>
1651
- <div class="refsect2">
1652
- <a name="g-task-get-source-object"></a><h3>g_task_get_source_object ()</h3>
1653
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> g_task_get_source_object (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1654
- <p>
1655
- Gets the source object from <em class="parameter"><code>task</code></em>. Like
1656
- <a class="link" href="GAsyncResult.html#g-async-result-get-source-object" title="g_async_result_get_source_object ()"><code class="function">g_async_result_get_source_object()</code></a>, but does not ref the object.
1657
- </p>
1658
- <div class="variablelist"><table border="0" class="variablelist">
1659
- <colgroup>
1660
- <col align="left" valign="top">
1661
- <col>
1662
- </colgroup>
1663
- <tbody>
1664
- <tr>
1665
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1666
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1667
- </td>
1668
- </tr>
1669
- <tr>
1670
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1671
- <td>
1672
- <em class="parameter"><code>task</code></em>'s source object, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
1673
- </td>
1674
- </tr>
1675
- </tbody>
1676
- </table></div>
1677
- <p class="since">Since 2.36</p>
1678
- </div>
1679
- <hr>
1680
- <div class="refsect2">
1681
- <a name="g-task-get-source-tag"></a><h3>g_task_get_source_tag ()</h3>
1682
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> g_task_get_source_tag (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1683
- <p>
1684
- Gets <em class="parameter"><code>task</code></em>'s source tag. See <a class="link" href="GTask.html#g-task-set-source-tag" title="g_task_set_source_tag ()"><code class="function">g_task_set_source_tag()</code></a>.
1685
- </p>
1686
- <div class="variablelist"><table border="0" class="variablelist">
1687
- <colgroup>
1688
- <col align="left" valign="top">
1689
- <col>
1690
- </colgroup>
1691
- <tbody>
1692
- <tr>
1693
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1694
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1695
- </td>
1696
- </tr>
1697
- <tr>
1698
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1699
- <td>
1700
- <em class="parameter"><code>task</code></em>'s source tag. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
1701
- </td>
1702
- </tr>
1703
- </tbody>
1704
- </table></div>
1705
- <p class="since">Since 2.36</p>
1706
- </div>
1707
- <hr>
1708
- <div class="refsect2">
1709
- <a name="g-task-return-boolean"></a><h3>g_task_return_boolean ()</h3>
1710
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_return_boolean (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1711
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> result</code></em>);</pre>
1712
- <p>
1713
- Sets <em class="parameter"><code>task</code></em>'s result to <em class="parameter"><code>result</code></em> and completes the task (see
1714
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> for more discussion of exactly what this
1715
- means).
1716
- </p>
1717
- <div class="variablelist"><table border="0" class="variablelist">
1718
- <colgroup>
1719
- <col align="left" valign="top">
1720
- <col>
1721
- </colgroup>
1722
- <tbody>
1723
- <tr>
1724
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1725
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1726
- </tr>
1727
- <tr>
1728
- <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
1729
- <td>the <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> result of a task function.</td>
1730
- </tr>
1731
- </tbody>
1732
- </table></div>
1733
- <p class="since">Since 2.36</p>
1734
- </div>
1735
- <hr>
1736
- <div class="refsect2">
1737
- <a name="g-task-return-int"></a><h3>g_task_return_int ()</h3>
1738
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_return_int (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1739
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="type">gssize</span></a> result</code></em>);</pre>
1740
- <p>
1741
- Sets <em class="parameter"><code>task</code></em>'s result to <em class="parameter"><code>result</code></em> and completes the task (see
1742
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> for more discussion of exactly what this
1743
- means).
1744
- </p>
1745
- <div class="variablelist"><table border="0" class="variablelist">
1746
- <colgroup>
1747
- <col align="left" valign="top">
1748
- <col>
1749
- </colgroup>
1750
- <tbody>
1751
- <tr>
1752
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1753
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1754
- </tr>
1755
- <tr>
1756
- <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
1757
- <td>the integer (<a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>) result of a task function.</td>
1758
- </tr>
1759
- </tbody>
1760
- </table></div>
1761
- <p class="since">Since 2.36</p>
1762
- </div>
1763
- <hr>
1764
- <div class="refsect2">
1765
- <a name="g-task-return-pointer"></a><h3>g_task_return_pointer ()</h3>
1766
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_return_pointer (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1767
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> result</code></em>,
1768
- <em class="parameter"><code><a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> result_destroy</code></em>);</pre>
1769
- <p>
1770
- Sets <em class="parameter"><code>task</code></em>'s result to <em class="parameter"><code>result</code></em> and completes the task. If <em class="parameter"><code>result</code></em>
1771
- is not <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then <em class="parameter"><code>result_destroy</code></em> will be used to free <em class="parameter"><code>result</code></em> if
1772
- the caller does not take ownership of it with
1773
- <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a>.
1774
- </p>
1775
- <p>
1776
- "Completes the task" means that for an ordinary asynchronous task
1777
- it will either invoke the task's callback, or else queue that
1778
- callback to be invoked in the proper <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>, or in the next
1779
- iteration of the current <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>. For a task run via
1780
- <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> or <a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()"><code class="function">g_task_run_in_thread_sync()</code></a>, calling this
1781
- method will save <em class="parameter"><code>result</code></em> to be returned to the caller later, but
1782
- the task will not actually be completed until the <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a>
1783
- exits.
1784
- </p>
1785
- <p>
1786
- Note that since the task may be completed before returning from
1787
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a>, you cannot assume that <em class="parameter"><code>result</code></em> is still
1788
- valid after calling this, unless you are still holding another
1789
- reference on it.
1790
- </p>
1791
- <div class="variablelist"><table border="0" class="variablelist">
1792
- <colgroup>
1793
- <col align="left" valign="top">
1794
- <col>
1795
- </colgroup>
1796
- <tbody>
1797
- <tr>
1798
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1799
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1800
- </td>
1801
- </tr>
1802
- <tr>
1803
- <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
1804
- <td>the pointer result of a task
1805
- function. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1806
- </td>
1807
- </tr>
1808
- <tr>
1809
- <td><p><span class="term"><em class="parameter"><code>result_destroy</code></em> :</span></p></td>
1810
- <td>a <a href="./../glib/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> function. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1811
- </td>
1812
- </tr>
1813
- </tbody>
1814
- </table></div>
1815
- <p class="since">Since 2.36</p>
1816
- </div>
1817
- <hr>
1818
- <div class="refsect2">
1819
- <a name="g-task-return-error"></a><h3>g_task_return_error ()</h3>
1820
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_return_error (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1821
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1822
- <p>
1823
- Sets <em class="parameter"><code>task</code></em>'s result to <em class="parameter"><code>error</code></em> (which <em class="parameter"><code>task</code></em> assumes ownership of)
1824
- and completes the task (see <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> for more
1825
- discussion of exactly what this means).
1826
- </p>
1827
- <p>
1828
- Note that since the task takes ownership of <em class="parameter"><code>error</code></em>, and since the
1829
- task may be completed before returning from <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a>,
1830
- you cannot assume that <em class="parameter"><code>error</code></em> is still valid after calling this.
1831
- Call <a href="./../glib/glib/glib-Error-Reporting.html#g-error-copy"><code class="function">g_error_copy()</code></a> on the error if you need to keep a local copy
1832
- as well.
1833
- </p>
1834
- <p>
1835
- See also <a class="link" href="GTask.html#g-task-return-new-error" title="g_task_return_new_error ()"><code class="function">g_task_return_new_error()</code></a>.
1836
- </p>
1837
- <div class="variablelist"><table border="0" class="variablelist">
1838
- <colgroup>
1839
- <col align="left" valign="top">
1840
- <col>
1841
- </colgroup>
1842
- <tbody>
1843
- <tr>
1844
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1845
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1846
- </tr>
1847
- <tr>
1848
- <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1849
- <td>the <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> result of a task function. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1850
- </td>
1851
- </tr>
1852
- </tbody>
1853
- </table></div>
1854
- <p class="since">Since 2.36</p>
1855
- </div>
1856
- <hr>
1857
- <div class="refsect2">
1858
- <a name="g-task-return-new-error"></a><h3>g_task_return_new_error ()</h3>
1859
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_return_new_error (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1860
- <em class="parameter"><code><a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
1861
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
1862
- <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
1863
- <em class="parameter"><code>...</code></em>);</pre>
1864
- <p>
1865
- Sets <em class="parameter"><code>task</code></em>'s result to a new <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> created from <em class="parameter"><code>domain</code></em>, <em class="parameter"><code>code</code></em>,
1866
- <em class="parameter"><code>format</code></em>, and the remaining arguments, and completes the task (see
1867
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> for more discussion of exactly what this
1868
- means).
1869
- </p>
1870
- <p>
1871
- See also <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a>.
1872
- </p>
1873
- <div class="variablelist"><table border="0" class="variablelist">
1874
- <colgroup>
1875
- <col align="left" valign="top">
1876
- <col>
1877
- </colgroup>
1878
- <tbody>
1879
- <tr>
1880
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1881
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1882
- </tr>
1883
- <tr>
1884
- <td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
1885
- <td>a <a href="./../glib/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.</td>
1886
- </tr>
1887
- <tr>
1888
- <td><p><span class="term"><em class="parameter"><code>code</code></em> :</span></p></td>
1889
- <td>an error code.</td>
1890
- </tr>
1891
- <tr>
1892
- <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
1893
- <td>a string with format characters.</td>
1894
- </tr>
1895
- <tr>
1896
- <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1897
- <td>a list of values to insert into <em class="parameter"><code>format</code></em>.</td>
1898
- </tr>
1899
- </tbody>
1900
- </table></div>
1901
- <p class="since">Since 2.36</p>
1902
- </div>
1903
- <hr>
1904
- <div class="refsect2">
1905
- <a name="g-task-return-error-if-cancelled"></a><h3>g_task_return_error_if_cancelled ()</h3>
1906
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_return_error_if_cancelled (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
1907
- <p>
1908
- Checks if <em class="parameter"><code>task</code></em>'s <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> has been cancelled, and if so, sets
1909
- <em class="parameter"><code>task</code></em>'s error accordingly and completes the task (see
1910
- <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> for more discussion of exactly what this
1911
- means).
1912
- </p>
1913
- <div class="variablelist"><table border="0" class="variablelist">
1914
- <colgroup>
1915
- <col align="left" valign="top">
1916
- <col>
1917
- </colgroup>
1918
- <tbody>
1919
- <tr>
1920
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1921
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
1922
- </td>
1923
- </tr>
1924
- <tr>
1925
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1926
- <td>
1927
- <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>task</code></em> has been cancelled, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not</td>
1928
- </tr>
1929
- </tbody>
1930
- </table></div>
1931
- <p class="since">Since 2.36</p>
1932
- </div>
1933
- <hr>
1934
- <div class="refsect2">
1935
- <a name="g-task-propagate-boolean"></a><h3>g_task_propagate_boolean ()</h3>
1936
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_propagate_boolean (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1937
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1938
- <p>
1939
- Gets the result of <em class="parameter"><code>task</code></em> as a <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>.
1940
- </p>
1941
- <p>
1942
- If the task resulted in an error, or was cancelled, then this will
1943
- instead return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>.
1944
- </p>
1945
- <p>
1946
- Since this method transfers ownership of the return value (or
1947
- error) to the caller, you may only call it once.
1948
- </p>
1949
- <div class="variablelist"><table border="0" class="variablelist">
1950
- <colgroup>
1951
- <col align="left" valign="top">
1952
- <col>
1953
- </colgroup>
1954
- <tbody>
1955
- <tr>
1956
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1957
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1958
- </tr>
1959
- <tr>
1960
- <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1961
- <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
1962
- </td>
1963
- </tr>
1964
- <tr>
1965
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1966
- <td>the task result, or <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error</td>
1967
- </tr>
1968
- </tbody>
1969
- </table></div>
1970
- <p class="since">Since 2.36</p>
1971
- </div>
1972
- <hr>
1973
- <div class="refsect2">
1974
- <a name="g-task-propagate-int"></a><h3>g_task_propagate_int ()</h3>
1975
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a> g_task_propagate_int (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
1976
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1977
- <p>
1978
- Gets the result of <em class="parameter"><code>task</code></em> as an integer (<a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>).
1979
- </p>
1980
- <p>
1981
- If the task resulted in an error, or was cancelled, then this will
1982
- instead return -1 and set <em class="parameter"><code>error</code></em>.
1983
- </p>
1984
- <p>
1985
- Since this method transfers ownership of the return value (or
1986
- error) to the caller, you may only call it once.
1987
- </p>
1988
- <div class="variablelist"><table border="0" class="variablelist">
1989
- <colgroup>
1990
- <col align="left" valign="top">
1991
- <col>
1992
- </colgroup>
1993
- <tbody>
1994
- <tr>
1995
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
1996
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
1997
- </tr>
1998
- <tr>
1999
- <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2000
- <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
2001
- </td>
2002
- </tr>
2003
- <tr>
2004
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2005
- <td>the task result, or -1 on error</td>
2006
- </tr>
2007
- </tbody>
2008
- </table></div>
2009
- <p class="since">Since 2.36</p>
2010
- </div>
2011
- <hr>
2012
- <div class="refsect2">
2013
- <a name="g-task-propagate-pointer"></a><h3>g_task_propagate_pointer ()</h3>
2014
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> g_task_propagate_pointer (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
2015
- <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2016
- <p>
2017
- Gets the result of <em class="parameter"><code>task</code></em> as a pointer, and transfers ownership
2018
- of that value to the caller.
2019
- </p>
2020
- <p>
2021
- If the task resulted in an error, or was cancelled, then this will
2022
- instead return <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and set <em class="parameter"><code>error</code></em>.
2023
- </p>
2024
- <p>
2025
- Since this method transfers ownership of the return value (or
2026
- error) to the caller, you may only call it once.
2027
- </p>
2028
- <div class="variablelist"><table border="0" class="variablelist">
2029
- <colgroup>
2030
- <col align="left" valign="top">
2031
- <col>
2032
- </colgroup>
2033
- <tbody>
2034
- <tr>
2035
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2036
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
2037
- </td>
2038
- </tr>
2039
- <tr>
2040
- <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2041
- <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
2042
- </td>
2043
- </tr>
2044
- <tr>
2045
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2046
- <td>the task result, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
2047
- </td>
2048
- </tr>
2049
- </tbody>
2050
- </table></div>
2051
- <p class="since">Since 2.36</p>
2052
- </div>
2053
- <hr>
2054
- <div class="refsect2">
2055
- <a name="g-task-had-error"></a><h3>g_task_had_error ()</h3>
2056
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_had_error (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>);</pre>
2057
- <p>
2058
- Tests if <em class="parameter"><code>task</code></em> resulted in an error.
2059
- </p>
2060
- <div class="variablelist"><table border="0" class="variablelist">
2061
- <colgroup>
2062
- <col align="left" valign="top">
2063
- <col>
2064
- </colgroup>
2065
- <tbody>
2066
- <tr>
2067
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2068
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>.</td>
2069
- </tr>
2070
- <tr>
2071
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2072
- <td>
2073
- <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the task resulted in an error, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
2074
- </tr>
2075
- </tbody>
2076
- </table></div>
2077
- <p class="since">Since 2.36</p>
2078
- </div>
2079
- <hr>
2080
- <div class="refsect2">
2081
- <a name="g-task-run-in-thread"></a><h3>g_task_run_in_thread ()</h3>
2082
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_run_in_thread (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
2083
- <em class="parameter"><code><a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> task_func</code></em>);</pre>
2084
- <p>
2085
- Runs <em class="parameter"><code>task_func</code></em> in another thread. When <em class="parameter"><code>task_func</code></em> returns, <em class="parameter"><code>task</code></em>'s
2086
- <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> will be invoked in <em class="parameter"><code>task</code></em>'s <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>.
2087
- </p>
2088
- <p>
2089
- This takes a ref on <em class="parameter"><code>task</code></em> until the task completes.
2090
- </p>
2091
- <p>
2092
- See <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> for more details about how <em class="parameter"><code>task_func</code></em> is handled.
2093
- </p>
2094
- <div class="variablelist"><table border="0" class="variablelist">
2095
- <colgroup>
2096
- <col align="left" valign="top">
2097
- <col>
2098
- </colgroup>
2099
- <tbody>
2100
- <tr>
2101
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2102
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
2103
- </td>
2104
- </tr>
2105
- <tr>
2106
- <td><p><span class="term"><em class="parameter"><code>task_func</code></em> :</span></p></td>
2107
- <td>a <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a>
2108
- </td>
2109
- </tr>
2110
- </tbody>
2111
- </table></div>
2112
- <p class="since">Since 2.36</p>
2113
- </div>
2114
- <hr>
2115
- <div class="refsect2">
2116
- <a name="g-task-run-in-thread-sync"></a><h3>g_task_run_in_thread_sync ()</h3>
2117
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_run_in_thread_sync (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
2118
- <em class="parameter"><code><a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> task_func</code></em>);</pre>
2119
- <p>
2120
- Runs <em class="parameter"><code>task_func</code></em> in another thread, and waits for it to return or be
2121
- cancelled. You can use <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a>, etc, afterward
2122
- to get the result of <em class="parameter"><code>task_func</code></em>.
2123
- </p>
2124
- <p>
2125
- See <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> for more details about how <em class="parameter"><code>task_func</code></em> is handled.
2126
- </p>
2127
- <p>
2128
- Normally this is used with tasks created with a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
2129
- <code class="literal">callback</code>, but note that even if the task does
2130
- have a callback, it will not be invoked when <em class="parameter"><code>task_func</code></em> returns.
2131
- </p>
2132
- <div class="variablelist"><table border="0" class="variablelist">
2133
- <colgroup>
2134
- <col align="left" valign="top">
2135
- <col>
2136
- </colgroup>
2137
- <tbody>
2138
- <tr>
2139
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2140
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
2141
- </td>
2142
- </tr>
2143
- <tr>
2144
- <td><p><span class="term"><em class="parameter"><code>task_func</code></em> :</span></p></td>
2145
- <td>a <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a>
2146
- </td>
2147
- </tr>
2148
- </tbody>
2149
- </table></div>
2150
- <p class="since">Since 2.36</p>
2151
- </div>
2152
- <hr>
2153
- <div class="refsect2">
2154
- <a name="GTaskThreadFunc"></a><h3>GTaskThreadFunc ()</h3>
2155
- <pre class="programlisting"><span class="returnvalue">void</span> (*GTaskThreadFunc) (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
2156
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>,
2157
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> task_data</code></em>,
2158
- <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
2159
- <p>
2160
- The prototype for a task function to be run in a thread via
2161
- <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> or <a class="link" href="GTask.html#g-task-run-in-thread-sync" title="g_task_run_in_thread_sync ()"><code class="function">g_task_run_in_thread_sync()</code></a>.
2162
- </p>
2163
- <p>
2164
- If the return-on-cancel flag is set on <em class="parameter"><code>task</code></em>, and <em class="parameter"><code>cancellable</code></em> gets
2165
- cancelled, then the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> will be completed immediately (as though
2166
- <a class="link" href="GTask.html#g-task-return-error-if-cancelled" title="g_task_return_error_if_cancelled ()"><code class="function">g_task_return_error_if_cancelled()</code></a> had been called), without
2167
- waiting for the task function to complete. However, the task
2168
- function will continue running in its thread in the background. The
2169
- function therefore needs to be careful about how it uses
2170
- externally-visible state in this case. See
2171
- <a class="link" href="GTask.html#g-task-set-return-on-cancel" title="g_task_set_return_on_cancel ()"><code class="function">g_task_set_return_on_cancel()</code></a> for more details.
2172
- </p>
2173
- <p>
2174
- Other than in that case, <em class="parameter"><code>task</code></em> will be completed when the
2175
- <a class="link" href="GTask.html#GTaskThreadFunc" title="GTaskThreadFunc ()"><span class="type">GTaskThreadFunc</span></a> returns, <span class="emphasis"><em>not</em></span> when it calls
2176
- a <code class="literal">g_task_return_</code> function.
2177
- </p>
2178
- <div class="variablelist"><table border="0" class="variablelist">
2179
- <colgroup>
2180
- <col align="left" valign="top">
2181
- <col>
2182
- </colgroup>
2183
- <tbody>
2184
- <tr>
2185
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2186
- <td>the <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
2187
- </td>
2188
- </tr>
2189
- <tr>
2190
- <td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td>
2191
- <td>
2192
- <em class="parameter"><code>task</code></em>'s source object. <span class="annotation">[<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
2193
- </td>
2194
- </tr>
2195
- <tr>
2196
- <td><p><span class="term"><em class="parameter"><code>task_data</code></em> :</span></p></td>
2197
- <td>
2198
- <em class="parameter"><code>task</code></em>'s task data</td>
2199
- </tr>
2200
- <tr>
2201
- <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
2202
- <td>
2203
- <em class="parameter"><code>task</code></em>'s <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
2204
- </td>
2205
- </tr>
2206
- </tbody>
2207
- </table></div>
2208
- <p class="since">Since 2.36</p>
2209
- </div>
2210
- <hr>
2211
- <div class="refsect2">
2212
- <a name="g-task-attach-source"></a><h3>g_task_attach_source ()</h3>
2213
- <pre class="programlisting"><span class="returnvalue">void</span> g_task_attach_source (<em class="parameter"><code><a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> *task</code></em>,
2214
- <em class="parameter"><code><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> *source</code></em>,
2215
- <em class="parameter"><code><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSourceFunc"><span class="type">GSourceFunc</span></a> callback</code></em>);</pre>
2216
- <p>
2217
- A utility function for dealing with async operations where you need
2218
- to wait for a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> to trigger. Attaches <em class="parameter"><code>source</code></em> to <em class="parameter"><code>task</code></em>'s
2219
- <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> with <em class="parameter"><code>task</code></em>'s <a class="link" href="GAsyncResult.html#io-priority">priority</a>, and sets <em class="parameter"><code>source</code></em>'s callback
2220
- to <em class="parameter"><code>callback</code></em>, with <em class="parameter"><code>task</code></em> as the callback's
2221
- <code class="literal">user_data</code>.
2222
- </p>
2223
- <p>
2224
- This takes a reference on <em class="parameter"><code>task</code></em> until <em class="parameter"><code>source</code></em> is destroyed.
2225
- </p>
2226
- <div class="variablelist"><table border="0" class="variablelist">
2227
- <colgroup>
2228
- <col align="left" valign="top">
2229
- <col>
2230
- </colgroup>
2231
- <tbody>
2232
- <tr>
2233
- <td><p><span class="term"><em class="parameter"><code>task</code></em> :</span></p></td>
2234
- <td>a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
2235
- </td>
2236
- </tr>
2237
- <tr>
2238
- <td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td>
2239
- <td>the source to attach</td>
2240
- </tr>
2241
- <tr>
2242
- <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
2243
- <td>the callback to invoke when <em class="parameter"><code>source</code></em> triggers</td>
2244
- </tr>
2245
- </tbody>
2246
- </table></div>
2247
- <p class="since">Since 2.36</p>
2248
- </div>
2249
- <hr>
2250
- <div class="refsect2">
2251
- <a name="g-task-is-valid"></a><h3>g_task_is_valid ()</h3>
2252
- <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_task_is_valid (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> result</code></em>,
2253
- <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_object</code></em>);</pre>
2254
- <p>
2255
- Checks that <em class="parameter"><code>result</code></em> is a <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>, and that <em class="parameter"><code>source_object</code></em> is its
2256
- source object (or that <em class="parameter"><code>source_object</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and <em class="parameter"><code>result</code></em> has no
2257
- source object). This can be used in <a href="./../glib/glib/glib-Warnings-and-Assertions.html#g-return-if-fail"><code class="function">g_return_if_fail()</code></a> checks.
2258
- </p>
2259
- <div class="variablelist"><table border="0" class="variablelist">
2260
- <colgroup>
2261
- <col align="left" valign="top">
2262
- <col>
2263
- </colgroup>
2264
- <tbody>
2265
- <tr>
2266
- <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
2267
- <td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>. <span class="annotation">[<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> Gio.AsyncResult]</span>
2268
- </td>
2269
- </tr>
2270
- <tr>
2271
- <td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td>
2272
- <td>the source object
2273
- expected to be associated with the task. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> GObject]</span>
2274
- </td>
2275
- </tr>
2276
- <tr>
2277
- <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2278
- <td>
2279
- <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>result</code></em> and <em class="parameter"><code>source_object</code></em> are valid, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
2280
- if not</td>
2281
- </tr>
2282
- </tbody>
2283
- </table></div>
2284
- <p class="since">Since 2.36</p>
2285
- </div>
2286
- </div>
2287
- <div class="refsect1">
2288
- <a name="GTask.see-also"></a><h2>See Also</h2>
2289
- <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>
2290
- </div>
2291
- </div>
2292
- <div class="footer">
2293
- <hr>
2294
- Generated by GTK-Doc V1.18</div>
2295
- </body>
2296
- </html>