atk 0.90.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (849) hide show
  1. data/ChangeLog +241 -0
  2. data/README +30 -0
  3. data/Rakefile +74 -0
  4. data/ext/atk/Makefile +160 -0
  5. data/ext/atk/atk.def +2 -0
  6. data/ext/atk/depend +8 -0
  7. data/ext/atk/extconf.rb +60 -0
  8. data/ext/atk/makeinits.rb +39 -0
  9. data/ext/atk/rbatk.c +27 -0
  10. data/ext/atk/rbatk.h +36 -0
  11. data/ext/atk/rbatkaction.c +81 -0
  12. data/ext/atk/rbatkcomponent.c +184 -0
  13. data/ext/atk/rbatkdocument.c +95 -0
  14. data/ext/atk/rbatkeditabletext.c +102 -0
  15. data/ext/atk/rbatkgobjectaccessible.c +37 -0
  16. data/ext/atk/rbatkhyperlink.c +92 -0
  17. data/ext/atk/rbatkhypertext.c +44 -0
  18. data/ext/atk/rbatkimage.c +62 -0
  19. data/ext/atk/rbatkimplementor.c +27 -0
  20. data/ext/atk/rbatkinits.c +55 -0
  21. data/ext/atk/rbatknoopobject.c +30 -0
  22. data/ext/atk/rbatknoopobjectfactory.c +30 -0
  23. data/ext/atk/rbatkobject.c +178 -0
  24. data/ext/atk/rbatkobjectfactory.c +44 -0
  25. data/ext/atk/rbatkregistry.c +55 -0
  26. data/ext/atk/rbatkrelation.c +104 -0
  27. data/ext/atk/rbatkrelationset.c +94 -0
  28. data/ext/atk/rbatkselection.c +82 -0
  29. data/ext/atk/rbatkstate.c +41 -0
  30. data/ext/atk/rbatkstateset.c +143 -0
  31. data/ext/atk/rbatkstreamablecontent.c +50 -0
  32. data/ext/atk/rbatktable.c +292 -0
  33. data/ext/atk/rbatktext.c +364 -0
  34. data/ext/atk/rbatktextrange.c +91 -0
  35. data/ext/atk/rbatktextrectangle.c +156 -0
  36. data/ext/atk/rbatkutil.c +125 -0
  37. data/ext/atk/rbatkvalue.c +74 -0
  38. data/ext/atk/rbatkversion.h +24 -0
  39. data/extconf.rb +49 -0
  40. data/lib/1.8/atk.so +0 -0
  41. data/lib/1.9/atk.so +0 -0
  42. data/lib/atk.rb +12 -0
  43. data/vendor/local/bin/envsubst.exe +0 -0
  44. data/vendor/local/bin/gettext.exe +0 -0
  45. data/vendor/local/bin/gettext.sh +123 -0
  46. data/vendor/local/bin/glib-genmarshal.exe +0 -0
  47. data/vendor/local/bin/glib-gettextize +188 -0
  48. data/vendor/local/bin/glib-mkenums +511 -0
  49. data/vendor/local/bin/gobject-query.exe +0 -0
  50. data/vendor/local/bin/gspawn-win32-helper-console.exe +0 -0
  51. data/vendor/local/bin/gspawn-win32-helper.exe +0 -0
  52. data/vendor/local/bin/intl.dll +0 -0
  53. data/vendor/local/bin/libasprintf-0.dll +0 -0
  54. data/vendor/local/bin/libatk-1.0-0.dll +0 -0
  55. data/vendor/local/bin/libgcc_s_dw2-1.dll +0 -0
  56. data/vendor/local/bin/libgio-2.0-0.dll +0 -0
  57. data/vendor/local/bin/libglib-2.0-0.dll +0 -0
  58. data/vendor/local/bin/libgmodule-2.0-0.dll +0 -0
  59. data/vendor/local/bin/libgobject-2.0-0.dll +0 -0
  60. data/vendor/local/bin/libgthread-2.0-0.dll +0 -0
  61. data/vendor/local/bin/ngettext.exe +0 -0
  62. data/vendor/local/include/atk-1.0/atk/atk-enum-types.h +45 -0
  63. data/vendor/local/include/atk-1.0/atk/atk.h +56 -0
  64. data/vendor/local/include/atk-1.0/atk/atkaction.h +111 -0
  65. data/vendor/local/include/atk-1.0/atk/atkcomponent.h +171 -0
  66. data/vendor/local/include/atk-1.0/atk/atkdocument.h +83 -0
  67. data/vendor/local/include/atk-1.0/atk/atkeditabletext.h +104 -0
  68. data/vendor/local/include/atk-1.0/atk/atkgobjectaccessible.h +65 -0
  69. data/vendor/local/include/atk-1.0/atk/atkhyperlink.h +106 -0
  70. data/vendor/local/include/atk-1.0/atk/atkhyperlinkimpl.h +75 -0
  71. data/vendor/local/include/atk-1.0/atk/atkhypertext.h +78 -0
  72. data/vendor/local/include/atk-1.0/atk/atkimage.h +87 -0
  73. data/vendor/local/include/atk-1.0/atk/atkmisc.h +89 -0
  74. data/vendor/local/include/atk-1.0/atk/atknoopobject.h +55 -0
  75. data/vendor/local/include/atk-1.0/atk/atknoopobjectfactory.h +57 -0
  76. data/vendor/local/include/atk-1.0/atk/atkobject.h +649 -0
  77. data/vendor/local/include/atk-1.0/atk/atkobjectfactory.h +67 -0
  78. data/vendor/local/include/atk-1.0/atk/atkplug.h +61 -0
  79. data/vendor/local/include/atk-1.0/atk/atkregistry.h +69 -0
  80. data/vendor/local/include/atk-1.0/atk/atkrelation.h +89 -0
  81. data/vendor/local/include/atk-1.0/atk/atkrelationset.h +78 -0
  82. data/vendor/local/include/atk-1.0/atk/atkrelationtype.h +83 -0
  83. data/vendor/local/include/atk-1.0/atk/atkselection.h +95 -0
  84. data/vendor/local/include/atk-1.0/atk/atksocket.h +65 -0
  85. data/vendor/local/include/atk-1.0/atk/atkstate.h +178 -0
  86. data/vendor/local/include/atk-1.0/atk/atkstateset.h +80 -0
  87. data/vendor/local/include/atk-1.0/atk/atkstreamablecontent.h +105 -0
  88. data/vendor/local/include/atk-1.0/atk/atktable.h +217 -0
  89. data/vendor/local/include/atk-1.0/atk/atktext.h +365 -0
  90. data/vendor/local/include/atk-1.0/atk/atkutil.h +313 -0
  91. data/vendor/local/include/atk-1.0/atk/atkvalue.h +93 -0
  92. data/vendor/local/include/autosprintf.h +66 -0
  93. data/vendor/local/include/glib-2.0/gio/gappinfo.h +237 -0
  94. data/vendor/local/include/glib-2.0/gio/gasyncinitable.h +119 -0
  95. data/vendor/local/include/glib-2.0/gio/gasyncresult.h +73 -0
  96. data/vendor/local/include/glib-2.0/gio/gbufferedinputstream.h +123 -0
  97. data/vendor/local/include/glib-2.0/gio/gbufferedoutputstream.h +82 -0
  98. data/vendor/local/include/glib-2.0/gio/gcancellable.h +103 -0
  99. data/vendor/local/include/glib-2.0/gio/gcharsetconverter.h +60 -0
  100. data/vendor/local/include/glib-2.0/gio/gcontenttype.h +57 -0
  101. data/vendor/local/include/glib-2.0/gio/gconverter.h +95 -0
  102. data/vendor/local/include/glib-2.0/gio/gconverterinputstream.h +80 -0
  103. data/vendor/local/include/glib-2.0/gio/gconverteroutputstream.h +80 -0
  104. data/vendor/local/include/glib-2.0/gio/gdatainputstream.h +133 -0
  105. data/vendor/local/include/glib-2.0/gio/gdataoutputstream.h +116 -0
  106. data/vendor/local/include/glib-2.0/gio/gdrive.h +225 -0
  107. data/vendor/local/include/glib-2.0/gio/gemblem.h +58 -0
  108. data/vendor/local/include/glib-2.0/gio/gemblemedicon.h +62 -0
  109. data/vendor/local/include/glib-2.0/gio/gfile.h +1017 -0
  110. data/vendor/local/include/glib-2.0/gio/gfileattribute.h +77 -0
  111. data/vendor/local/include/glib-2.0/gio/gfileenumerator.h +133 -0
  112. data/vendor/local/include/glib-2.0/gio/gfileicon.h +56 -0
  113. data/vendor/local/include/glib-2.0/gio/gfileinfo.h +951 -0
  114. data/vendor/local/include/glib-2.0/gio/gfileinputstream.h +112 -0
  115. data/vendor/local/include/glib-2.0/gio/gfileiostream.h +118 -0
  116. data/vendor/local/include/glib-2.0/gio/gfilemonitor.h +95 -0
  117. data/vendor/local/include/glib-2.0/gio/gfilenamecompleter.h +76 -0
  118. data/vendor/local/include/glib-2.0/gio/gfileoutputstream.h +119 -0
  119. data/vendor/local/include/glib-2.0/gio/gfilterinputstream.h +76 -0
  120. data/vendor/local/include/glib-2.0/gio/gfilteroutputstream.h +76 -0
  121. data/vendor/local/include/glib-2.0/gio/gicon.h +91 -0
  122. data/vendor/local/include/glib-2.0/gio/ginetaddress.h +103 -0
  123. data/vendor/local/include/glib-2.0/gio/ginetsocketaddress.h +69 -0
  124. data/vendor/local/include/glib-2.0/gio/ginitable.h +96 -0
  125. data/vendor/local/include/glib-2.0/gio/ginputstream.h +172 -0
  126. data/vendor/local/include/glib-2.0/gio/gio.h +101 -0
  127. data/vendor/local/include/glib-2.0/gio/gioenums.h +703 -0
  128. data/vendor/local/include/glib-2.0/gio/gioenumtypes.h +79 -0
  129. data/vendor/local/include/glib-2.0/gio/gioerror.h +48 -0
  130. data/vendor/local/include/glib-2.0/gio/giomodule.h +132 -0
  131. data/vendor/local/include/glib-2.0/gio/gioscheduler.h +52 -0
  132. data/vendor/local/include/glib-2.0/gio/giostream.h +112 -0
  133. data/vendor/local/include/glib-2.0/gio/giotypes.h +339 -0
  134. data/vendor/local/include/glib-2.0/gio/gloadableicon.h +97 -0
  135. data/vendor/local/include/glib-2.0/gio/gmemoryinputstream.h +82 -0
  136. data/vendor/local/include/glib-2.0/gio/gmemoryoutputstream.h +97 -0
  137. data/vendor/local/include/glib-2.0/gio/gmount.h +242 -0
  138. data/vendor/local/include/glib-2.0/gio/gmountoperation.h +123 -0
  139. data/vendor/local/include/glib-2.0/gio/gnativevolumemonitor.h +62 -0
  140. data/vendor/local/include/glib-2.0/gio/gnetworkaddress.h +69 -0
  141. data/vendor/local/include/glib-2.0/gio/gnetworkservice.h +69 -0
  142. data/vendor/local/include/glib-2.0/gio/goutputstream.h +207 -0
  143. data/vendor/local/include/glib-2.0/gio/gresolver.h +167 -0
  144. data/vendor/local/include/glib-2.0/gio/gseekable.h +99 -0
  145. data/vendor/local/include/glib-2.0/gio/gsimpleasyncresult.h +125 -0
  146. data/vendor/local/include/glib-2.0/gio/gsocket.h +176 -0
  147. data/vendor/local/include/glib-2.0/gio/gsocketaddress.h +79 -0
  148. data/vendor/local/include/glib-2.0/gio/gsocketaddressenumerator.h +89 -0
  149. data/vendor/local/include/glib-2.0/gio/gsocketclient.h +130 -0
  150. data/vendor/local/include/glib-2.0/gio/gsocketconnectable.h +68 -0
  151. data/vendor/local/include/glib-2.0/gio/gsocketconnection.h +91 -0
  152. data/vendor/local/include/glib-2.0/gio/gsocketcontrolmessage.h +105 -0
  153. data/vendor/local/include/glib-2.0/gio/gsocketlistener.h +138 -0
  154. data/vendor/local/include/glib-2.0/gio/gsocketservice.h +88 -0
  155. data/vendor/local/include/glib-2.0/gio/gsrvtarget.h +52 -0
  156. data/vendor/local/include/glib-2.0/gio/gtcpconnection.h +68 -0
  157. data/vendor/local/include/glib-2.0/gio/gthemedicon.h +63 -0
  158. data/vendor/local/include/glib-2.0/gio/gthreadedsocketservice.h +81 -0
  159. data/vendor/local/include/glib-2.0/gio/gvfs.h +125 -0
  160. data/vendor/local/include/glib-2.0/gio/gvolume.h +211 -0
  161. data/vendor/local/include/glib-2.0/gio/gvolumemonitor.h +151 -0
  162. data/vendor/local/include/glib-2.0/gio/gzlibcompressor.h +55 -0
  163. data/vendor/local/include/glib-2.0/gio/gzlibdecompressor.h +54 -0
  164. data/vendor/local/include/glib-2.0/glib/galloca.h +63 -0
  165. data/vendor/local/include/glib-2.0/glib/garray.h +179 -0
  166. data/vendor/local/include/glib-2.0/glib/gasyncqueue.h +120 -0
  167. data/vendor/local/include/glib-2.0/glib/gatomic.h +85 -0
  168. data/vendor/local/include/glib-2.0/glib/gbacktrace.h +68 -0
  169. data/vendor/local/include/glib-2.0/glib/gbase64.h +57 -0
  170. data/vendor/local/include/glib-2.0/glib/gbitlock.h +43 -0
  171. data/vendor/local/include/glib-2.0/glib/gbookmarkfile.h +191 -0
  172. data/vendor/local/include/glib-2.0/glib/gcache.h +69 -0
  173. data/vendor/local/include/glib-2.0/glib/gchecksum.h +86 -0
  174. data/vendor/local/include/glib-2.0/glib/gcompletion.h +77 -0
  175. data/vendor/local/include/glib-2.0/glib/gconvert.h +138 -0
  176. data/vendor/local/include/glib-2.0/glib/gdataset.h +122 -0
  177. data/vendor/local/include/glib-2.0/glib/gdate.h +263 -0
  178. data/vendor/local/include/glib-2.0/glib/gdir.h +52 -0
  179. data/vendor/local/include/glib-2.0/glib/gerror.h +98 -0
  180. data/vendor/local/include/glib-2.0/glib/gfileutils.h +128 -0
  181. data/vendor/local/include/glib-2.0/glib/ghash.h +166 -0
  182. data/vendor/local/include/glib-2.0/glib/ghook.h +181 -0
  183. data/vendor/local/include/glib-2.0/glib/ghostutils.h +40 -0
  184. data/vendor/local/include/glib-2.0/glib/gi18n-lib.h +38 -0
  185. data/vendor/local/include/glib-2.0/glib/gi18n.h +34 -0
  186. data/vendor/local/include/glib-2.0/glib/giochannel.h +366 -0
  187. data/vendor/local/include/glib-2.0/glib/gkeyfile.h +250 -0
  188. data/vendor/local/include/glib-2.0/glib/glist.h +120 -0
  189. data/vendor/local/include/glib-2.0/glib/gmacros.h +277 -0
  190. data/vendor/local/include/glib-2.0/glib/gmain.h +304 -0
  191. data/vendor/local/include/glib-2.0/glib/gmappedfile.h +49 -0
  192. data/vendor/local/include/glib-2.0/glib/gmarkup.h +163 -0
  193. data/vendor/local/include/glib-2.0/glib/gmem.h +203 -0
  194. data/vendor/local/include/glib-2.0/glib/gmessages.h +343 -0
  195. data/vendor/local/include/glib-2.0/glib/gnode.h +288 -0
  196. data/vendor/local/include/glib-2.0/glib/goption.h +370 -0
  197. data/vendor/local/include/glib-2.0/glib/gpattern.h +49 -0
  198. data/vendor/local/include/glib-2.0/glib/gpoll.h +93 -0
  199. data/vendor/local/include/glib-2.0/glib/gprimes.h +51 -0
  200. data/vendor/local/include/glib-2.0/glib/gprintf.h +52 -0
  201. data/vendor/local/include/glib-2.0/glib/gqsort.h +46 -0
  202. data/vendor/local/include/glib-2.0/glib/gquark.h +52 -0
  203. data/vendor/local/include/glib-2.0/glib/gqueue.h +127 -0
  204. data/vendor/local/include/glib-2.0/glib/grand.h +85 -0
  205. data/vendor/local/include/glib-2.0/glib/gregex.h +243 -0
  206. data/vendor/local/include/glib-2.0/glib/grel.h +97 -0
  207. data/vendor/local/include/glib-2.0/glib/gscanner.h +278 -0
  208. data/vendor/local/include/glib-2.0/glib/gsequence.h +128 -0
  209. data/vendor/local/include/glib-2.0/glib/gshell.h +55 -0
  210. data/vendor/local/include/glib-2.0/glib/gslice.h +86 -0
  211. data/vendor/local/include/glib-2.0/glib/gslist.h +114 -0
  212. data/vendor/local/include/glib-2.0/glib/gspawn.h +139 -0
  213. data/vendor/local/include/glib-2.0/glib/gstdio.h +159 -0
  214. data/vendor/local/include/glib-2.0/glib/gstrfuncs.h +267 -0
  215. data/vendor/local/include/glib-2.0/glib/gstring.h +178 -0
  216. data/vendor/local/include/glib-2.0/glib/gtestutils.h +292 -0
  217. data/vendor/local/include/glib-2.0/glib/gthread.h +408 -0
  218. data/vendor/local/include/glib-2.0/glib/gthreadpool.h +114 -0
  219. data/vendor/local/include/glib-2.0/glib/gtimer.h +65 -0
  220. data/vendor/local/include/glib-2.0/glib/gtree.h +91 -0
  221. data/vendor/local/include/glib-2.0/glib/gtypes.h +451 -0
  222. data/vendor/local/include/glib-2.0/glib/gunicode.h +404 -0
  223. data/vendor/local/include/glib-2.0/glib/gurifuncs.h +81 -0
  224. data/vendor/local/include/glib-2.0/glib/gutils.h +490 -0
  225. data/vendor/local/include/glib-2.0/glib/gvariant.h +224 -0
  226. data/vendor/local/include/glib-2.0/glib/gvarianttype.h +305 -0
  227. data/vendor/local/include/glib-2.0/glib/gwin32.h +114 -0
  228. data/vendor/local/include/glib-2.0/glib-object.h +41 -0
  229. data/vendor/local/include/glib-2.0/glib.h +97 -0
  230. data/vendor/local/include/glib-2.0/gmodule.h +101 -0
  231. data/vendor/local/include/glib-2.0/gobject/gboxed.h +236 -0
  232. data/vendor/local/include/glib-2.0/gobject/gclosure.h +251 -0
  233. data/vendor/local/include/glib-2.0/gobject/genums.h +261 -0
  234. data/vendor/local/include/glib-2.0/gobject/gmarshal.h +169 -0
  235. data/vendor/local/include/glib-2.0/gobject/gobject.h +562 -0
  236. data/vendor/local/include/glib-2.0/gobject/gobjectnotifyqueue.c +166 -0
  237. data/vendor/local/include/glib-2.0/gobject/gparam.h +410 -0
  238. data/vendor/local/include/glib-2.0/gobject/gparamspecs.h +1083 -0
  239. data/vendor/local/include/glib-2.0/gobject/gsignal.h +509 -0
  240. data/vendor/local/include/glib-2.0/gobject/gsourceclosure.h +51 -0
  241. data/vendor/local/include/glib-2.0/gobject/gtype.h +1608 -0
  242. data/vendor/local/include/glib-2.0/gobject/gtypemodule.h +263 -0
  243. data/vendor/local/include/glib-2.0/gobject/gtypeplugin.h +134 -0
  244. data/vendor/local/include/glib-2.0/gobject/gvalue.h +159 -0
  245. data/vendor/local/include/glib-2.0/gobject/gvaluearray.h +77 -0
  246. data/vendor/local/include/glib-2.0/gobject/gvaluecollector.h +222 -0
  247. data/vendor/local/include/glib-2.0/gobject/gvaluetypes.h +243 -0
  248. data/vendor/local/include/libintl.h +464 -0
  249. data/vendor/local/lib/GNU.Gettext.dll +0 -0
  250. data/vendor/local/lib/atk-1.0.def +237 -0
  251. data/vendor/local/lib/atk-1.0.lib +0 -0
  252. data/vendor/local/lib/gio-2.0.def +800 -0
  253. data/vendor/local/lib/gio-2.0.lib +0 -0
  254. data/vendor/local/lib/glib-2.0/include/glibconfig.h +284 -0
  255. data/vendor/local/lib/glib-2.0.def +1381 -0
  256. data/vendor/local/lib/glib-2.0.lib +0 -0
  257. data/vendor/local/lib/gmodule-2.0.def +11 -0
  258. data/vendor/local/lib/gmodule-2.0.lib +0 -0
  259. data/vendor/local/lib/gobject-2.0.def +349 -0
  260. data/vendor/local/lib/gobject-2.0.lib +0 -0
  261. data/vendor/local/lib/gthread-2.0.def +3 -0
  262. data/vendor/local/lib/gthread-2.0.lib +0 -0
  263. data/vendor/local/lib/intl.lib +0 -0
  264. data/vendor/local/lib/libasprintf.dll.a +0 -0
  265. data/vendor/local/lib/libatk-1.0.dll.a +0 -0
  266. data/vendor/local/lib/libgio-2.0.dll.a +0 -0
  267. data/vendor/local/lib/libglib-2.0.dll.a +0 -0
  268. data/vendor/local/lib/libgmodule-2.0.dll.a +0 -0
  269. data/vendor/local/lib/libgobject-2.0.dll.a +0 -0
  270. data/vendor/local/lib/libgthread-2.0.dll.a +0 -0
  271. data/vendor/local/lib/libintl.def +31 -0
  272. data/vendor/local/lib/libintl.dll.a +0 -0
  273. data/vendor/local/lib/pkgconfig/atk.pc +11 -0
  274. data/vendor/local/lib/pkgconfig/gio-2.0.pc +14 -0
  275. data/vendor/local/lib/pkgconfig/glib-2.0.pc +15 -0
  276. data/vendor/local/lib/pkgconfig/gmodule-2.0.pc +14 -0
  277. data/vendor/local/lib/pkgconfig/gmodule-no-export-2.0.pc +14 -0
  278. data/vendor/local/lib/pkgconfig/gobject-2.0.pc +11 -0
  279. data/vendor/local/lib/pkgconfig/gthread-2.0.pc +11 -0
  280. data/vendor/local/manifest/atk-dev_1.30.0-2_win32.mft +37 -0
  281. data/vendor/local/manifest/atk_1.30.0-2_win32.mft +93 -0
  282. data/vendor/local/manifest/gettext-runtime-dev_0.18.1.1-2_win32.mft +81 -0
  283. data/vendor/local/manifest/gettext-runtime_0.18.1.1-2_win32.mft +3 -0
  284. data/vendor/local/manifest/glib-dev_2.24.2-2_win32.mft +491 -0
  285. data/vendor/local/manifest/glib_2.24.2-2_win32.mft +101 -0
  286. data/vendor/local/share/aclocal/glib-2.0.m4 +211 -0
  287. data/vendor/local/share/aclocal/glib-gettext.m4 +432 -0
  288. data/vendor/local/share/doc/gettext/bind_textdomain_codeset.3.html +165 -0
  289. data/vendor/local/share/doc/gettext/bindtextdomain.3.html +160 -0
  290. data/vendor/local/share/doc/gettext/csharpdoc/GNU_Gettext.html +8 -0
  291. data/vendor/local/share/doc/gettext/csharpdoc/GNU_Gettext_GettextResourceManager.html +305 -0
  292. data/vendor/local/share/doc/gettext/csharpdoc/GNU_Gettext_GettextResourceSet.html +356 -0
  293. data/vendor/local/share/doc/gettext/csharpdoc/begin.html +11 -0
  294. data/vendor/local/share/doc/gettext/csharpdoc/index.html +10 -0
  295. data/vendor/local/share/doc/gettext/csharpdoc/namespaces.html +6 -0
  296. data/vendor/local/share/doc/gettext/envsubst.1.html +213 -0
  297. data/vendor/local/share/doc/gettext/gettext.1.html +266 -0
  298. data/vendor/local/share/doc/gettext/gettext.3.html +186 -0
  299. data/vendor/local/share/doc/gettext/ngettext.1.html +280 -0
  300. data/vendor/local/share/doc/gettext/ngettext.3.html +143 -0
  301. data/vendor/local/share/doc/gettext/textdomain.3.html +150 -0
  302. data/vendor/local/share/doc/glib-2.24.2/COPYING +482 -0
  303. data/vendor/local/share/doc/glib-dev-2.24.2/COPYING +482 -0
  304. data/vendor/local/share/doc/libasprintf/autosprintf_all.html +174 -0
  305. data/vendor/local/share/glib-2.0/gdb/glib.py +252 -0
  306. data/vendor/local/share/glib-2.0/gdb/gobject.py +305 -0
  307. data/vendor/local/share/glib-2.0/gettext/mkinstalldirs +111 -0
  308. data/vendor/local/share/glib-2.0/gettext/po/Makefile.in.in +277 -0
  309. data/vendor/local/share/gtk-doc/html/gio/GAppInfo.html +1390 -0
  310. data/vendor/local/share/gtk-doc/html/gio/GAsyncInitable.html +531 -0
  311. data/vendor/local/share/gtk-doc/html/gio/GAsyncResult.html +343 -0
  312. data/vendor/local/share/gtk-doc/html/gio/GBufferedInputStream.html +568 -0
  313. data/vendor/local/share/gtk-doc/html/gio/GBufferedOutputStream.html +295 -0
  314. data/vendor/local/share/gtk-doc/html/gio/GCancellable.html +620 -0
  315. data/vendor/local/share/gtk-doc/html/gio/GCharsetConverter.html +245 -0
  316. data/vendor/local/share/gtk-doc/html/gio/GConverter.html +388 -0
  317. data/vendor/local/share/gtk-doc/html/gio/GDataInputStream.html +993 -0
  318. data/vendor/local/share/gtk-doc/html/gio/GDataOutputStream.html +544 -0
  319. data/vendor/local/share/gtk-doc/html/gio/GDrive.html +1416 -0
  320. data/vendor/local/share/gtk-doc/html/gio/GEmblem.html +272 -0
  321. data/vendor/local/share/gtk-doc/html/gio/GEmblemedIcon.html +206 -0
  322. data/vendor/local/share/gtk-doc/html/gio/GFile.html +7450 -0
  323. data/vendor/local/share/gtk-doc/html/gio/GFileDescriptorBased.html +115 -0
  324. data/vendor/local/share/gtk-doc/html/gio/GFileEnumerator.html +520 -0
  325. data/vendor/local/share/gtk-doc/html/gio/GFileIOStream.html +312 -0
  326. data/vendor/local/share/gtk-doc/html/gio/GFileIcon.html +155 -0
  327. data/vendor/local/share/gtk-doc/html/gio/GFileInfo.html +3116 -0
  328. data/vendor/local/share/gtk-doc/html/gio/GFileInputStream.html +262 -0
  329. data/vendor/local/share/gtk-doc/html/gio/GFileMonitor.html +353 -0
  330. data/vendor/local/share/gtk-doc/html/gio/GFileOutputStream.html +301 -0
  331. data/vendor/local/share/gtk-doc/html/gio/GFilenameCompleter.html +217 -0
  332. data/vendor/local/share/gtk-doc/html/gio/GFilterInputStream.html +182 -0
  333. data/vendor/local/share/gtk-doc/html/gio/GFilterOutputStream.html +183 -0
  334. data/vendor/local/share/gtk-doc/html/gio/GIOModule.html +261 -0
  335. data/vendor/local/share/gtk-doc/html/gio/GIOStream.html +479 -0
  336. data/vendor/local/share/gtk-doc/html/gio/GIcon.html +331 -0
  337. data/vendor/local/share/gtk-doc/html/gio/GInetAddress.html +717 -0
  338. data/vendor/local/share/gtk-doc/html/gio/GInetSocketAddress.html +195 -0
  339. data/vendor/local/share/gtk-doc/html/gio/GInitable.html +388 -0
  340. data/vendor/local/share/gtk-doc/html/gio/GInputStream.html +808 -0
  341. data/vendor/local/share/gtk-doc/html/gio/GLoadableIcon.html +301 -0
  342. data/vendor/local/share/gtk-doc/html/gio/GMemoryInputStream.html +185 -0
  343. data/vendor/local/share/gtk-doc/html/gio/GMemoryOutputStream.html +362 -0
  344. data/vendor/local/share/gtk-doc/html/gio/GMount.html +1465 -0
  345. data/vendor/local/share/gtk-doc/html/gio/GMountOperation.html +848 -0
  346. data/vendor/local/share/gtk-doc/html/gio/GNetworkAddress.html +263 -0
  347. data/vendor/local/share/gtk-doc/html/gio/GNetworkService.html +248 -0
  348. data/vendor/local/share/gtk-doc/html/gio/GOutputStream.html +1006 -0
  349. data/vendor/local/share/gtk-doc/html/gio/GResolver.html +787 -0
  350. data/vendor/local/share/gtk-doc/html/gio/GSeekable.html +350 -0
  351. data/vendor/local/share/gtk-doc/html/gio/GSimpleAsyncResult.html +979 -0
  352. data/vendor/local/share/gtk-doc/html/gio/GSocket.html +2152 -0
  353. data/vendor/local/share/gtk-doc/html/gio/GSocketAddress.html +297 -0
  354. data/vendor/local/share/gtk-doc/html/gio/GSocketClient.html +930 -0
  355. data/vendor/local/share/gtk-doc/html/gio/GSocketConnectable.html +428 -0
  356. data/vendor/local/share/gtk-doc/html/gio/GSocketConnection.html +548 -0
  357. data/vendor/local/share/gtk-doc/html/gio/GSocketControlMessage.html +274 -0
  358. data/vendor/local/share/gtk-doc/html/gio/GSocketListener.html +741 -0
  359. data/vendor/local/share/gtk-doc/html/gio/GSocketService.html +258 -0
  360. data/vendor/local/share/gtk-doc/html/gio/GThemedIcon.html +377 -0
  361. data/vendor/local/share/gtk-doc/html/gio/GThreadedSocketService.html +197 -0
  362. data/vendor/local/share/gtk-doc/html/gio/GUnixFDList.html +381 -0
  363. data/vendor/local/share/gtk-doc/html/gio/GUnixFDMessage.html +280 -0
  364. data/vendor/local/share/gtk-doc/html/gio/GUnixInputStream.html +237 -0
  365. data/vendor/local/share/gtk-doc/html/gio/GUnixOutputStream.html +237 -0
  366. data/vendor/local/share/gtk-doc/html/gio/GUnixSocketAddress.html +306 -0
  367. data/vendor/local/share/gtk-doc/html/gio/GVfs.html +274 -0
  368. data/vendor/local/share/gtk-doc/html/gio/GVolume.html +1028 -0
  369. data/vendor/local/share/gtk-doc/html/gio/GVolumeMonitor.html +709 -0
  370. data/vendor/local/share/gtk-doc/html/gio/GZlibCompressor.html +180 -0
  371. data/vendor/local/share/gtk-doc/html/gio/GZlibDecompressor.html +128 -0
  372. data/vendor/local/share/gtk-doc/html/gio/api-index-2-18.html +153 -0
  373. data/vendor/local/share/gtk-doc/html/gio/api-index-2-20.html +155 -0
  374. data/vendor/local/share/gtk-doc/html/gio/api-index-2-22.html +1088 -0
  375. data/vendor/local/share/gtk-doc/html/gio/api-index-2-24.html +206 -0
  376. data/vendor/local/share/gtk-doc/html/gio/api-index-deprecated.html +97 -0
  377. data/vendor/local/share/gtk-doc/html/gio/api-index-full.html +4499 -0
  378. data/vendor/local/share/gtk-doc/html/gio/async.html +44 -0
  379. data/vendor/local/share/gtk-doc/html/gio/ch01.html +171 -0
  380. data/vendor/local/share/gtk-doc/html/gio/ch02.html +45 -0
  381. data/vendor/local/share/gtk-doc/html/gio/ch03.html +80 -0
  382. data/vendor/local/share/gtk-doc/html/gio/ch19.html +75 -0
  383. data/vendor/local/share/gtk-doc/html/gio/ch20.html +217 -0
  384. data/vendor/local/share/gtk-doc/html/gio/ch20s02.html +41 -0
  385. data/vendor/local/share/gtk-doc/html/gio/ch20s03.html +39 -0
  386. data/vendor/local/share/gtk-doc/html/gio/conversion.html +44 -0
  387. data/vendor/local/share/gtk-doc/html/gio/extending-gio.html +96 -0
  388. data/vendor/local/share/gtk-doc/html/gio/extending.html +41 -0
  389. data/vendor/local/share/gtk-doc/html/gio/failable_initialization.html +38 -0
  390. data/vendor/local/share/gtk-doc/html/gio/file_mon.html +33 -0
  391. data/vendor/local/share/gtk-doc/html/gio/file_ops.html +50 -0
  392. data/vendor/local/share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html +339 -0
  393. data/vendor/local/share/gtk-doc/html/gio/gio-Extension-Points.html +465 -0
  394. data/vendor/local/share/gtk-doc/html/gio/gio-GContentType.html +381 -0
  395. data/vendor/local/share/gtk-doc/html/gio/gio-GConverterInputstream.html +163 -0
  396. data/vendor/local/share/gtk-doc/html/gio/gio-GConverterOutputstream.html +163 -0
  397. data/vendor/local/share/gtk-doc/html/gio/gio-GFileAttribute.html +927 -0
  398. data/vendor/local/share/gtk-doc/html/gio/gio-GIOError.html +328 -0
  399. data/vendor/local/share/gtk-doc/html/gio/gio-GIOScheduler.html +297 -0
  400. data/vendor/local/share/gtk-doc/html/gio/gio-GSrvTarget.html +313 -0
  401. data/vendor/local/share/gtk-doc/html/gio/gio-Unix-Mounts.html +918 -0
  402. data/vendor/local/share/gtk-doc/html/gio/gio-hierarchy.html +107 -0
  403. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp +1235 -0
  404. data/vendor/local/share/gtk-doc/html/gio/gio.devhelp2 +1384 -0
  405. data/vendor/local/share/gtk-doc/html/gio/gvfs-overview.png +0 -0
  406. data/vendor/local/share/gtk-doc/html/gio/highlevel-socket.html +47 -0
  407. data/vendor/local/share/gtk-doc/html/gio/home.png +0 -0
  408. data/vendor/local/share/gtk-doc/html/gio/icons.html +50 -0
  409. data/vendor/local/share/gtk-doc/html/gio/index.html +318 -0
  410. data/vendor/local/share/gtk-doc/html/gio/index.sgml +1795 -0
  411. data/vendor/local/share/gtk-doc/html/gio/left.png +0 -0
  412. data/vendor/local/share/gtk-doc/html/gio/migrating.html +42 -0
  413. data/vendor/local/share/gtk-doc/html/gio/networking.html +57 -0
  414. data/vendor/local/share/gtk-doc/html/gio/pt01.html +39 -0
  415. data/vendor/local/share/gtk-doc/html/gio/pt02.html +293 -0
  416. data/vendor/local/share/gtk-doc/html/gio/resolver.html +47 -0
  417. data/vendor/local/share/gtk-doc/html/gio/right.png +0 -0
  418. data/vendor/local/share/gtk-doc/html/gio/streaming.html +92 -0
  419. data/vendor/local/share/gtk-doc/html/gio/style.css +257 -0
  420. data/vendor/local/share/gtk-doc/html/gio/types.html +41 -0
  421. data/vendor/local/share/gtk-doc/html/gio/up.png +0 -0
  422. data/vendor/local/share/gtk-doc/html/gio/utils.html +33 -0
  423. data/vendor/local/share/gtk-doc/html/gio/volume_mon.html +47 -0
  424. data/vendor/local/share/gtk-doc/html/glib/api-index-2-10.html +180 -0
  425. data/vendor/local/share/gtk-doc/html/glib/api-index-2-12.html +312 -0
  426. data/vendor/local/share/gtk-doc/html/glib/api-index-2-14.html +563 -0
  427. data/vendor/local/share/gtk-doc/html/glib/api-index-2-16.html +362 -0
  428. data/vendor/local/share/gtk-doc/html/glib/api-index-2-18.html +102 -0
  429. data/vendor/local/share/gtk-doc/html/glib/api-index-2-2.html +124 -0
  430. data/vendor/local/share/gtk-doc/html/glib/api-index-2-20.html +83 -0
  431. data/vendor/local/share/gtk-doc/html/glib/api-index-2-22.html +194 -0
  432. data/vendor/local/share/gtk-doc/html/glib/api-index-2-24.html +419 -0
  433. data/vendor/local/share/gtk-doc/html/glib/api-index-2-4.html +389 -0
  434. data/vendor/local/share/gtk-doc/html/glib/api-index-2-6.html +413 -0
  435. data/vendor/local/share/gtk-doc/html/glib/api-index-2-8.html +158 -0
  436. data/vendor/local/share/gtk-doc/html/glib/api-index-deprecated.html +340 -0
  437. data/vendor/local/share/gtk-doc/html/glib/api-index-full.html +7835 -0
  438. data/vendor/local/share/gtk-doc/html/glib/file-name-encodings.png +0 -0
  439. data/vendor/local/share/gtk-doc/html/glib/glib-Arrays.html +893 -0
  440. data/vendor/local/share/gtk-doc/html/glib/glib-Asynchronous-Queues.html +818 -0
  441. data/vendor/local/share/gtk-doc/html/glib/glib-Atomic-Operations.html +413 -0
  442. data/vendor/local/share/gtk-doc/html/glib/glib-Automatic-String-Completion.html +430 -0
  443. data/vendor/local/share/gtk-doc/html/glib/glib-Balanced-Binary-Trees.html +802 -0
  444. data/vendor/local/share/gtk-doc/html/glib/glib-Base64-Encoding.html +372 -0
  445. data/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html +500 -0
  446. data/vendor/local/share/gtk-doc/html/glib/glib-Bookmark-file-parser.html +2054 -0
  447. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Arrays.html +560 -0
  448. data/vendor/local/share/gtk-doc/html/glib/glib-Byte-Order-Macros.html +1686 -0
  449. data/vendor/local/share/gtk-doc/html/glib/glib-Caches.html +398 -0
  450. data/vendor/local/share/gtk-doc/html/glib/glib-Character-Set-Conversion.html +1187 -0
  451. data/vendor/local/share/gtk-doc/html/glib/glib-Commandline-option-parser.html +1665 -0
  452. data/vendor/local/share/gtk-doc/html/glib/glib-Data-Checksums.html +460 -0
  453. data/vendor/local/share/gtk-doc/html/glib/glib-Datasets.html +528 -0
  454. data/vendor/local/share/gtk-doc/html/glib/glib-Date-and-Time-Functions.html +2042 -0
  455. data/vendor/local/share/gtk-doc/html/glib/glib-Double-ended-Queues.html +1278 -0
  456. data/vendor/local/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html +1406 -0
  457. data/vendor/local/share/gtk-doc/html/glib/glib-Dynamic-Loading-of-Modules.html +548 -0
  458. data/vendor/local/share/gtk-doc/html/glib/glib-Error-Reporting.html +1023 -0
  459. data/vendor/local/share/gtk-doc/html/glib/glib-File-Utilities.html +1810 -0
  460. data/vendor/local/share/gtk-doc/html/glib/glib-GVariant.html +3798 -0
  461. data/vendor/local/share/gtk-doc/html/glib/glib-GVariantType.html +1815 -0
  462. data/vendor/local/share/gtk-doc/html/glib/glib-Glob-style-pattern-matching.html +295 -0
  463. data/vendor/local/share/gtk-doc/html/glib/glib-Hash-Tables.html +1512 -0
  464. data/vendor/local/share/gtk-doc/html/glib/glib-Hook-Functions.html +1367 -0
  465. data/vendor/local/share/gtk-doc/html/glib/glib-Hostname-Utilities.html +229 -0
  466. data/vendor/local/share/gtk-doc/html/glib/glib-I18N.html +629 -0
  467. data/vendor/local/share/gtk-doc/html/glib/glib-IO-Channels.html +2196 -0
  468. data/vendor/local/share/gtk-doc/html/glib/glib-Key-value-file-parser.html +2556 -0
  469. data/vendor/local/share/gtk-doc/html/glib/glib-Keyed-Data-Lists.html +612 -0
  470. data/vendor/local/share/gtk-doc/html/glib/glib-Lexical-Scanner.html +1451 -0
  471. data/vendor/local/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html +389 -0
  472. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocation.html +1029 -0
  473. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Allocators.html +141 -0
  474. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Chunks.html +706 -0
  475. data/vendor/local/share/gtk-doc/html/glib/glib-Memory-Slices.html +510 -0
  476. data/vendor/local/share/gtk-doc/html/glib/glib-Message-Logging.html +703 -0
  477. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Macros.html +1045 -0
  478. data/vendor/local/share/gtk-doc/html/glib/glib-Miscellaneous-Utility-Functions.html +1523 -0
  479. data/vendor/local/share/gtk-doc/html/glib/glib-N-ary-Trees.html +1466 -0
  480. data/vendor/local/share/gtk-doc/html/glib/glib-Numerical-Definitions.html +204 -0
  481. data/vendor/local/share/gtk-doc/html/glib/glib-Perl-compatible-regular-expressions.html +2648 -0
  482. data/vendor/local/share/gtk-doc/html/glib/glib-Pointer-Arrays.html +752 -0
  483. data/vendor/local/share/gtk-doc/html/glib/glib-Quarks.html +269 -0
  484. data/vendor/local/share/gtk-doc/html/glib/glib-Random-Numbers.html +578 -0
  485. data/vendor/local/share/gtk-doc/html/glib/glib-Relations-and-Tuples.html +483 -0
  486. data/vendor/local/share/gtk-doc/html/glib/glib-Sequences.html +1353 -0
  487. data/vendor/local/share/gtk-doc/html/glib/glib-Shell-related-Utilities.html +238 -0
  488. data/vendor/local/share/gtk-doc/html/glib/glib-Simple-XML-Subset-Parser.html +1283 -0
  489. data/vendor/local/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html +1212 -0
  490. data/vendor/local/share/gtk-doc/html/glib/glib-Spawning-Processes.html +924 -0
  491. data/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html +466 -0
  492. data/vendor/local/share/gtk-doc/html/glib/glib-String-Chunks.html +301 -0
  493. data/vendor/local/share/gtk-doc/html/glib/glib-String-Utility-Functions.html +2947 -0
  494. data/vendor/local/share/gtk-doc/html/glib/glib-Strings.html +1290 -0
  495. data/vendor/local/share/gtk-doc/html/glib/glib-Testing.html +1719 -0
  496. data/vendor/local/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html +3379 -0
  497. data/vendor/local/share/gtk-doc/html/glib/glib-Thread-Pools.html +606 -0
  498. data/vendor/local/share/gtk-doc/html/glib/glib-Threads.html +3411 -0
  499. data/vendor/local/share/gtk-doc/html/glib/glib-Timers.html +245 -0
  500. data/vendor/local/share/gtk-doc/html/glib/glib-Trash-Stacks.html +188 -0
  501. data/vendor/local/share/gtk-doc/html/glib/glib-Type-Conversion-Macros.html +263 -0
  502. data/vendor/local/share/gtk-doc/html/glib/glib-URI-Functions.html +314 -0
  503. data/vendor/local/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html +3356 -0
  504. data/vendor/local/share/gtk-doc/html/glib/glib-Version-Information.html +150 -0
  505. data/vendor/local/share/gtk-doc/html/glib/glib-Warnings-and-Assertions.html +438 -0
  506. data/vendor/local/share/gtk-doc/html/glib/glib-Windows-Compatibility-Functions.html +476 -0
  507. data/vendor/local/share/gtk-doc/html/glib/glib-building.html +438 -0
  508. data/vendor/local/share/gtk-doc/html/glib/glib-changes.html +159 -0
  509. data/vendor/local/share/gtk-doc/html/glib/glib-compiling.html +118 -0
  510. data/vendor/local/share/gtk-doc/html/glib/glib-core.html +64 -0
  511. data/vendor/local/share/gtk-doc/html/glib/glib-cross-compiling.html +160 -0
  512. data/vendor/local/share/gtk-doc/html/glib/glib-data-types.html +120 -0
  513. data/vendor/local/share/gtk-doc/html/glib/glib-fundamentals.html +59 -0
  514. data/vendor/local/share/gtk-doc/html/glib/glib-gettextize.html +93 -0
  515. data/vendor/local/share/gtk-doc/html/glib/glib-regex-syntax.html +2395 -0
  516. data/vendor/local/share/gtk-doc/html/glib/glib-resources.html +121 -0
  517. data/vendor/local/share/gtk-doc/html/glib/glib-running.html +302 -0
  518. data/vendor/local/share/gtk-doc/html/glib/glib-utilities.html +112 -0
  519. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp +2084 -0
  520. data/vendor/local/share/gtk-doc/html/glib/glib.devhelp2 +2556 -0
  521. data/vendor/local/share/gtk-doc/html/glib/glib.html +80 -0
  522. data/vendor/local/share/gtk-doc/html/glib/gtester-report.html +72 -0
  523. data/vendor/local/share/gtk-doc/html/glib/gtester.html +131 -0
  524. data/vendor/local/share/gtk-doc/html/glib/gvariant-format-strings.html +1171 -0
  525. data/vendor/local/share/gtk-doc/html/glib/home.png +0 -0
  526. data/vendor/local/share/gtk-doc/html/glib/index.html +336 -0
  527. data/vendor/local/share/gtk-doc/html/glib/index.sgml +2717 -0
  528. data/vendor/local/share/gtk-doc/html/glib/left.png +0 -0
  529. data/vendor/local/share/gtk-doc/html/glib/mainloop-states.gif +0 -0
  530. data/vendor/local/share/gtk-doc/html/glib/right.png +0 -0
  531. data/vendor/local/share/gtk-doc/html/glib/style.css +257 -0
  532. data/vendor/local/share/gtk-doc/html/glib/tools.html +41 -0
  533. data/vendor/local/share/gtk-doc/html/glib/up.png +0 -0
  534. data/vendor/local/share/gtk-doc/html/gobject/GTypeModule.html +710 -0
  535. data/vendor/local/share/gtk-doc/html/gobject/GTypePlugin.html +453 -0
  536. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-10.html +85 -0
  537. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-12.html +55 -0
  538. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-14.html +51 -0
  539. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-18.html +46 -0
  540. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-2.html +38 -0
  541. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-22.html +46 -0
  542. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-24.html +72 -0
  543. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-4.html +178 -0
  544. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-6.html +42 -0
  545. data/vendor/local/share/gtk-doc/html/gobject/api-index-2-8.html +42 -0
  546. data/vendor/local/share/gtk-doc/html/gobject/api-index-deprecated.html +50 -0
  547. data/vendor/local/share/gtk-doc/html/gobject/api-index-full.html +2577 -0
  548. data/vendor/local/share/gtk-doc/html/gobject/ch01s02.html +136 -0
  549. data/vendor/local/share/gtk-doc/html/gobject/ch06s03.html +113 -0
  550. data/vendor/local/share/gtk-doc/html/gobject/chapter-gobject.html +293 -0
  551. data/vendor/local/share/gtk-doc/html/gobject/chapter-gtype.html +263 -0
  552. data/vendor/local/share/gtk-doc/html/gobject/chapter-intro.html +92 -0
  553. data/vendor/local/share/gtk-doc/html/gobject/chapter-signal.html +214 -0
  554. data/vendor/local/share/gtk-doc/html/gobject/glib-genmarshal.html +355 -0
  555. data/vendor/local/share/gtk-doc/html/gobject/glib-mkenums.html +295 -0
  556. data/vendor/local/share/gtk-doc/html/gobject/glue.png +0 -0
  557. data/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html +406 -0
  558. data/vendor/local/share/gtk-doc/html/gobject/gobject-Closures.html +2355 -0
  559. data/vendor/local/share/gtk-doc/html/gobject/gobject-Enumeration-and-Flag-Types.html +847 -0
  560. data/vendor/local/share/gtk-doc/html/gobject/gobject-GParamSpec.html +1423 -0
  561. data/vendor/local/share/gtk-doc/html/gobject/gobject-Generic-values.html +776 -0
  562. data/vendor/local/share/gtk-doc/html/gobject/gobject-Signals.html +2741 -0
  563. data/vendor/local/share/gtk-doc/html/gobject/gobject-Standard-Parameter-and-Value-Types.html +5242 -0
  564. data/vendor/local/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html +2609 -0
  565. data/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html +4227 -0
  566. data/vendor/local/share/gtk-doc/html/gobject/gobject-Value-arrays.html +413 -0
  567. data/vendor/local/share/gtk-doc/html/gobject/gobject-Varargs-Value-Collection.html +230 -0
  568. data/vendor/local/share/gtk-doc/html/gobject/gobject-memory.html +234 -0
  569. data/vendor/local/share/gtk-doc/html/gobject/gobject-properties.html +270 -0
  570. data/vendor/local/share/gtk-doc/html/gobject/gobject-query.html +117 -0
  571. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp +723 -0
  572. data/vendor/local/share/gtk-doc/html/gobject/gobject.devhelp2 +757 -0
  573. data/vendor/local/share/gtk-doc/html/gobject/gtype-conventions.html +143 -0
  574. data/vendor/local/share/gtk-doc/html/gobject/gtype-instantiable-classed.html +287 -0
  575. data/vendor/local/share/gtk-doc/html/gobject/gtype-non-instantiable-classed.html +316 -0
  576. data/vendor/local/share/gtk-doc/html/gobject/gtype-non-instantiable.html +76 -0
  577. data/vendor/local/share/gtk-doc/html/gobject/home.png +0 -0
  578. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-chainup.html +100 -0
  579. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-code.html +86 -0
  580. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-construction.html +113 -0
  581. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-destruction.html +122 -0
  582. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject-methods.html +257 -0
  583. data/vendor/local/share/gtk-doc/html/gobject/howto-gobject.html +283 -0
  584. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-implement.html +125 -0
  585. data/vendor/local/share/gtk-doc/html/gobject/howto-interface-properties.html +167 -0
  586. data/vendor/local/share/gtk-doc/html/gobject/howto-interface.html +160 -0
  587. data/vendor/local/share/gtk-doc/html/gobject/howto-signals.html +121 -0
  588. data/vendor/local/share/gtk-doc/html/gobject/index.html +187 -0
  589. data/vendor/local/share/gtk-doc/html/gobject/index.sgml +734 -0
  590. data/vendor/local/share/gtk-doc/html/gobject/left.png +0 -0
  591. data/vendor/local/share/gtk-doc/html/gobject/pr01.html +72 -0
  592. data/vendor/local/share/gtk-doc/html/gobject/pt01.html +80 -0
  593. data/vendor/local/share/gtk-doc/html/gobject/pt02.html +66 -0
  594. data/vendor/local/share/gtk-doc/html/gobject/pt03.html +55 -0
  595. data/vendor/local/share/gtk-doc/html/gobject/right.png +0 -0
  596. data/vendor/local/share/gtk-doc/html/gobject/rn01.html +82 -0
  597. data/vendor/local/share/gtk-doc/html/gobject/rn02.html +47 -0
  598. data/vendor/local/share/gtk-doc/html/gobject/signal.html +377 -0
  599. data/vendor/local/share/gtk-doc/html/gobject/style.css +257 -0
  600. data/vendor/local/share/gtk-doc/html/gobject/tools-ginspector.html +35 -0
  601. data/vendor/local/share/gtk-doc/html/gobject/tools-gob.html +40 -0
  602. data/vendor/local/share/gtk-doc/html/gobject/tools-gtkdoc.html +63 -0
  603. data/vendor/local/share/gtk-doc/html/gobject/tools-refdb.html +55 -0
  604. data/vendor/local/share/gtk-doc/html/gobject/tools-vala.html +43 -0
  605. data/vendor/local/share/gtk-doc/html/gobject/up.png +0 -0
  606. data/vendor/local/share/locale/af/LC_MESSAGES/atk10.mo +0 -0
  607. data/vendor/local/share/locale/af/LC_MESSAGES/glib20.mo +0 -0
  608. data/vendor/local/share/locale/am/LC_MESSAGES/atk10.mo +0 -0
  609. data/vendor/local/share/locale/am/LC_MESSAGES/glib20.mo +0 -0
  610. data/vendor/local/share/locale/ar/LC_MESSAGES/atk10.mo +0 -0
  611. data/vendor/local/share/locale/ar/LC_MESSAGES/glib20.mo +0 -0
  612. data/vendor/local/share/locale/as/LC_MESSAGES/atk10.mo +0 -0
  613. data/vendor/local/share/locale/as/LC_MESSAGES/glib20.mo +0 -0
  614. data/vendor/local/share/locale/ast/LC_MESSAGES/atk10.mo +0 -0
  615. data/vendor/local/share/locale/ast/LC_MESSAGES/glib20.mo +0 -0
  616. data/vendor/local/share/locale/az/LC_MESSAGES/atk10.mo +0 -0
  617. data/vendor/local/share/locale/az/LC_MESSAGES/glib20.mo +0 -0
  618. data/vendor/local/share/locale/be/LC_MESSAGES/atk10.mo +0 -0
  619. data/vendor/local/share/locale/be/LC_MESSAGES/gettext-runtime.mo +0 -0
  620. data/vendor/local/share/locale/be/LC_MESSAGES/glib20.mo +0 -0
  621. data/vendor/local/share/locale/be@latin/LC_MESSAGES/atk10.mo +0 -0
  622. data/vendor/local/share/locale/be@latin/LC_MESSAGES/glib20.mo +0 -0
  623. data/vendor/local/share/locale/bg/LC_MESSAGES/atk10.mo +0 -0
  624. data/vendor/local/share/locale/bg/LC_MESSAGES/gettext-runtime.mo +0 -0
  625. data/vendor/local/share/locale/bg/LC_MESSAGES/glib20.mo +0 -0
  626. data/vendor/local/share/locale/bn/LC_MESSAGES/atk10.mo +0 -0
  627. data/vendor/local/share/locale/bn/LC_MESSAGES/glib20.mo +0 -0
  628. data/vendor/local/share/locale/bn_IN/LC_MESSAGES/atk10.mo +0 -0
  629. data/vendor/local/share/locale/bn_IN/LC_MESSAGES/glib20.mo +0 -0
  630. data/vendor/local/share/locale/bs/LC_MESSAGES/atk10.mo +0 -0
  631. data/vendor/local/share/locale/bs/LC_MESSAGES/glib20.mo +0 -0
  632. data/vendor/local/share/locale/ca/LC_MESSAGES/atk10.mo +0 -0
  633. data/vendor/local/share/locale/ca/LC_MESSAGES/gettext-runtime.mo +0 -0
  634. data/vendor/local/share/locale/ca/LC_MESSAGES/glib20.mo +0 -0
  635. data/vendor/local/share/locale/ca@valencia/LC_MESSAGES/atk10.mo +0 -0
  636. data/vendor/local/share/locale/ca@valencia/LC_MESSAGES/glib20.mo +0 -0
  637. data/vendor/local/share/locale/cs/LC_MESSAGES/atk10.mo +0 -0
  638. data/vendor/local/share/locale/cs/LC_MESSAGES/gettext-runtime.mo +0 -0
  639. data/vendor/local/share/locale/cs/LC_MESSAGES/glib20.mo +0 -0
  640. data/vendor/local/share/locale/cy/LC_MESSAGES/atk10.mo +0 -0
  641. data/vendor/local/share/locale/cy/LC_MESSAGES/glib20.mo +0 -0
  642. data/vendor/local/share/locale/da/LC_MESSAGES/atk10.mo +0 -0
  643. data/vendor/local/share/locale/da/LC_MESSAGES/gettext-runtime.mo +0 -0
  644. data/vendor/local/share/locale/da/LC_MESSAGES/glib20.mo +0 -0
  645. data/vendor/local/share/locale/de/LC_MESSAGES/atk10.mo +0 -0
  646. data/vendor/local/share/locale/de/LC_MESSAGES/gettext-runtime.mo +0 -0
  647. data/vendor/local/share/locale/de/LC_MESSAGES/glib20.mo +0 -0
  648. data/vendor/local/share/locale/dz/LC_MESSAGES/atk10.mo +0 -0
  649. data/vendor/local/share/locale/dz/LC_MESSAGES/glib20.mo +0 -0
  650. data/vendor/local/share/locale/el/LC_MESSAGES/atk10.mo +0 -0
  651. data/vendor/local/share/locale/el/LC_MESSAGES/gettext-runtime.mo +0 -0
  652. data/vendor/local/share/locale/el/LC_MESSAGES/glib20.mo +0 -0
  653. data/vendor/local/share/locale/en@boldquot/LC_MESSAGES/gettext-runtime.mo +0 -0
  654. data/vendor/local/share/locale/en@quot/LC_MESSAGES/gettext-runtime.mo +0 -0
  655. data/vendor/local/share/locale/en@shaw/LC_MESSAGES/atk10.mo +0 -0
  656. data/vendor/local/share/locale/en@shaw/LC_MESSAGES/glib20.mo +0 -0
  657. data/vendor/local/share/locale/en_CA/LC_MESSAGES/atk10.mo +0 -0
  658. data/vendor/local/share/locale/en_CA/LC_MESSAGES/glib20.mo +0 -0
  659. data/vendor/local/share/locale/en_GB/LC_MESSAGES/atk10.mo +0 -0
  660. data/vendor/local/share/locale/en_GB/LC_MESSAGES/glib20.mo +0 -0
  661. data/vendor/local/share/locale/eo/LC_MESSAGES/atk10.mo +0 -0
  662. data/vendor/local/share/locale/eo/LC_MESSAGES/gettext-runtime.mo +0 -0
  663. data/vendor/local/share/locale/eo/LC_MESSAGES/glib20.mo +0 -0
  664. data/vendor/local/share/locale/es/LC_MESSAGES/atk10.mo +0 -0
  665. data/vendor/local/share/locale/es/LC_MESSAGES/gettext-runtime.mo +0 -0
  666. data/vendor/local/share/locale/es/LC_MESSAGES/glib20.mo +0 -0
  667. data/vendor/local/share/locale/et/LC_MESSAGES/atk10.mo +0 -0
  668. data/vendor/local/share/locale/et/LC_MESSAGES/gettext-runtime.mo +0 -0
  669. data/vendor/local/share/locale/et/LC_MESSAGES/glib20.mo +0 -0
  670. data/vendor/local/share/locale/eu/LC_MESSAGES/atk10.mo +0 -0
  671. data/vendor/local/share/locale/eu/LC_MESSAGES/glib20.mo +0 -0
  672. data/vendor/local/share/locale/fa/LC_MESSAGES/atk10.mo +0 -0
  673. data/vendor/local/share/locale/fa/LC_MESSAGES/glib20.mo +0 -0
  674. data/vendor/local/share/locale/fi/LC_MESSAGES/atk10.mo +0 -0
  675. data/vendor/local/share/locale/fi/LC_MESSAGES/gettext-runtime.mo +0 -0
  676. data/vendor/local/share/locale/fi/LC_MESSAGES/glib20.mo +0 -0
  677. data/vendor/local/share/locale/fr/LC_MESSAGES/atk10.mo +0 -0
  678. data/vendor/local/share/locale/fr/LC_MESSAGES/gettext-runtime.mo +0 -0
  679. data/vendor/local/share/locale/fr/LC_MESSAGES/glib20.mo +0 -0
  680. data/vendor/local/share/locale/ga/LC_MESSAGES/atk10.mo +0 -0
  681. data/vendor/local/share/locale/ga/LC_MESSAGES/gettext-runtime.mo +0 -0
  682. data/vendor/local/share/locale/ga/LC_MESSAGES/glib20.mo +0 -0
  683. data/vendor/local/share/locale/gl/LC_MESSAGES/atk10.mo +0 -0
  684. data/vendor/local/share/locale/gl/LC_MESSAGES/gettext-runtime.mo +0 -0
  685. data/vendor/local/share/locale/gl/LC_MESSAGES/glib20.mo +0 -0
  686. data/vendor/local/share/locale/gu/LC_MESSAGES/atk10.mo +0 -0
  687. data/vendor/local/share/locale/gu/LC_MESSAGES/glib20.mo +0 -0
  688. data/vendor/local/share/locale/he/LC_MESSAGES/atk10.mo +0 -0
  689. data/vendor/local/share/locale/he/LC_MESSAGES/glib20.mo +0 -0
  690. data/vendor/local/share/locale/hi/LC_MESSAGES/atk10.mo +0 -0
  691. data/vendor/local/share/locale/hi/LC_MESSAGES/glib20.mo +0 -0
  692. data/vendor/local/share/locale/hr/LC_MESSAGES/atk10.mo +0 -0
  693. data/vendor/local/share/locale/hr/LC_MESSAGES/glib20.mo +0 -0
  694. data/vendor/local/share/locale/hu/LC_MESSAGES/atk10.mo +0 -0
  695. data/vendor/local/share/locale/hu/LC_MESSAGES/glib20.mo +0 -0
  696. data/vendor/local/share/locale/hy/LC_MESSAGES/glib20.mo +0 -0
  697. data/vendor/local/share/locale/id/LC_MESSAGES/atk10.mo +0 -0
  698. data/vendor/local/share/locale/id/LC_MESSAGES/gettext-runtime.mo +0 -0
  699. data/vendor/local/share/locale/id/LC_MESSAGES/glib20.mo +0 -0
  700. data/vendor/local/share/locale/is/LC_MESSAGES/atk10.mo +0 -0
  701. data/vendor/local/share/locale/is/LC_MESSAGES/glib20.mo +0 -0
  702. data/vendor/local/share/locale/it/LC_MESSAGES/atk10.mo +0 -0
  703. data/vendor/local/share/locale/it/LC_MESSAGES/gettext-runtime.mo +0 -0
  704. data/vendor/local/share/locale/it/LC_MESSAGES/glib20.mo +0 -0
  705. data/vendor/local/share/locale/ja/LC_MESSAGES/atk10.mo +0 -0
  706. data/vendor/local/share/locale/ja/LC_MESSAGES/gettext-runtime.mo +0 -0
  707. data/vendor/local/share/locale/ja/LC_MESSAGES/glib20.mo +0 -0
  708. data/vendor/local/share/locale/ka/LC_MESSAGES/atk10.mo +0 -0
  709. data/vendor/local/share/locale/ka/LC_MESSAGES/glib20.mo +0 -0
  710. data/vendor/local/share/locale/kn/LC_MESSAGES/atk10.mo +0 -0
  711. data/vendor/local/share/locale/kn/LC_MESSAGES/glib20.mo +0 -0
  712. data/vendor/local/share/locale/ko/LC_MESSAGES/atk10.mo +0 -0
  713. data/vendor/local/share/locale/ko/LC_MESSAGES/gettext-runtime.mo +0 -0
  714. data/vendor/local/share/locale/ko/LC_MESSAGES/glib20.mo +0 -0
  715. data/vendor/local/share/locale/ku/LC_MESSAGES/atk10.mo +0 -0
  716. data/vendor/local/share/locale/ku/LC_MESSAGES/glib20.mo +0 -0
  717. data/vendor/local/share/locale/li/LC_MESSAGES/atk10.mo +0 -0
  718. data/vendor/local/share/locale/locale.alias +77 -0
  719. data/vendor/local/share/locale/lt/LC_MESSAGES/atk10.mo +0 -0
  720. data/vendor/local/share/locale/lt/LC_MESSAGES/glib20.mo +0 -0
  721. data/vendor/local/share/locale/lv/LC_MESSAGES/atk10.mo +0 -0
  722. data/vendor/local/share/locale/lv/LC_MESSAGES/glib20.mo +0 -0
  723. data/vendor/local/share/locale/mai/LC_MESSAGES/atk10.mo +0 -0
  724. data/vendor/local/share/locale/mai/LC_MESSAGES/glib20.mo +0 -0
  725. data/vendor/local/share/locale/mg/LC_MESSAGES/glib20.mo +0 -0
  726. data/vendor/local/share/locale/mk/LC_MESSAGES/atk10.mo +0 -0
  727. data/vendor/local/share/locale/mk/LC_MESSAGES/glib20.mo +0 -0
  728. data/vendor/local/share/locale/ml/LC_MESSAGES/atk10.mo +0 -0
  729. data/vendor/local/share/locale/ml/LC_MESSAGES/glib20.mo +0 -0
  730. data/vendor/local/share/locale/mn/LC_MESSAGES/atk10.mo +0 -0
  731. data/vendor/local/share/locale/mn/LC_MESSAGES/glib20.mo +0 -0
  732. data/vendor/local/share/locale/mr/LC_MESSAGES/atk10.mo +0 -0
  733. data/vendor/local/share/locale/mr/LC_MESSAGES/glib20.mo +0 -0
  734. data/vendor/local/share/locale/ms/LC_MESSAGES/atk10.mo +0 -0
  735. data/vendor/local/share/locale/ms/LC_MESSAGES/glib20.mo +0 -0
  736. data/vendor/local/share/locale/nb/LC_MESSAGES/atk10.mo +0 -0
  737. data/vendor/local/share/locale/nb/LC_MESSAGES/gettext-runtime.mo +0 -0
  738. data/vendor/local/share/locale/nb/LC_MESSAGES/glib20.mo +0 -0
  739. data/vendor/local/share/locale/nds/LC_MESSAGES/glib20.mo +0 -0
  740. data/vendor/local/share/locale/ne/LC_MESSAGES/atk10.mo +0 -0
  741. data/vendor/local/share/locale/ne/LC_MESSAGES/glib20.mo +0 -0
  742. data/vendor/local/share/locale/nl/LC_MESSAGES/atk10.mo +0 -0
  743. data/vendor/local/share/locale/nl/LC_MESSAGES/gettext-runtime.mo +0 -0
  744. data/vendor/local/share/locale/nl/LC_MESSAGES/glib20.mo +0 -0
  745. data/vendor/local/share/locale/nn/LC_MESSAGES/atk10.mo +0 -0
  746. data/vendor/local/share/locale/nn/LC_MESSAGES/gettext-runtime.mo +0 -0
  747. data/vendor/local/share/locale/nn/LC_MESSAGES/glib20.mo +0 -0
  748. data/vendor/local/share/locale/oc/LC_MESSAGES/atk10.mo +0 -0
  749. data/vendor/local/share/locale/oc/LC_MESSAGES/glib20.mo +0 -0
  750. data/vendor/local/share/locale/or/LC_MESSAGES/atk10.mo +0 -0
  751. data/vendor/local/share/locale/or/LC_MESSAGES/glib20.mo +0 -0
  752. data/vendor/local/share/locale/pa/LC_MESSAGES/atk10.mo +0 -0
  753. data/vendor/local/share/locale/pa/LC_MESSAGES/glib20.mo +0 -0
  754. data/vendor/local/share/locale/pl/LC_MESSAGES/atk10.mo +0 -0
  755. data/vendor/local/share/locale/pl/LC_MESSAGES/gettext-runtime.mo +0 -0
  756. data/vendor/local/share/locale/pl/LC_MESSAGES/glib20.mo +0 -0
  757. data/vendor/local/share/locale/ps/LC_MESSAGES/atk10.mo +0 -0
  758. data/vendor/local/share/locale/ps/LC_MESSAGES/glib20.mo +0 -0
  759. data/vendor/local/share/locale/pt/LC_MESSAGES/atk10.mo +0 -0
  760. data/vendor/local/share/locale/pt/LC_MESSAGES/gettext-runtime.mo +0 -0
  761. data/vendor/local/share/locale/pt/LC_MESSAGES/glib20.mo +0 -0
  762. data/vendor/local/share/locale/pt_BR/LC_MESSAGES/atk10.mo +0 -0
  763. data/vendor/local/share/locale/pt_BR/LC_MESSAGES/gettext-runtime.mo +0 -0
  764. data/vendor/local/share/locale/pt_BR/LC_MESSAGES/glib20.mo +0 -0
  765. data/vendor/local/share/locale/ro/LC_MESSAGES/atk10.mo +0 -0
  766. data/vendor/local/share/locale/ro/LC_MESSAGES/gettext-runtime.mo +0 -0
  767. data/vendor/local/share/locale/ro/LC_MESSAGES/glib20.mo +0 -0
  768. data/vendor/local/share/locale/ru/LC_MESSAGES/atk10.mo +0 -0
  769. data/vendor/local/share/locale/ru/LC_MESSAGES/gettext-runtime.mo +0 -0
  770. data/vendor/local/share/locale/ru/LC_MESSAGES/glib20.mo +0 -0
  771. data/vendor/local/share/locale/rw/LC_MESSAGES/atk10.mo +0 -0
  772. data/vendor/local/share/locale/rw/LC_MESSAGES/glib20.mo +0 -0
  773. data/vendor/local/share/locale/si/LC_MESSAGES/atk10.mo +0 -0
  774. data/vendor/local/share/locale/si/LC_MESSAGES/glib20.mo +0 -0
  775. data/vendor/local/share/locale/sk/LC_MESSAGES/atk10.mo +0 -0
  776. data/vendor/local/share/locale/sk/LC_MESSAGES/gettext-runtime.mo +0 -0
  777. data/vendor/local/share/locale/sk/LC_MESSAGES/glib20.mo +0 -0
  778. data/vendor/local/share/locale/sl/LC_MESSAGES/atk10.mo +0 -0
  779. data/vendor/local/share/locale/sl/LC_MESSAGES/gettext-runtime.mo +0 -0
  780. data/vendor/local/share/locale/sl/LC_MESSAGES/glib20.mo +0 -0
  781. data/vendor/local/share/locale/sq/LC_MESSAGES/atk10.mo +0 -0
  782. data/vendor/local/share/locale/sq/LC_MESSAGES/glib20.mo +0 -0
  783. data/vendor/local/share/locale/sr/LC_MESSAGES/atk10.mo +0 -0
  784. data/vendor/local/share/locale/sr/LC_MESSAGES/gettext-runtime.mo +0 -0
  785. data/vendor/local/share/locale/sr/LC_MESSAGES/glib20.mo +0 -0
  786. data/vendor/local/share/locale/sr@ije/LC_MESSAGES/atk10.mo +0 -0
  787. data/vendor/local/share/locale/sr@ije/LC_MESSAGES/glib20.mo +0 -0
  788. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/atk10.mo +0 -0
  789. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/glib20.mo +0 -0
  790. data/vendor/local/share/locale/sv/LC_MESSAGES/atk10.mo +0 -0
  791. data/vendor/local/share/locale/sv/LC_MESSAGES/gettext-runtime.mo +0 -0
  792. data/vendor/local/share/locale/sv/LC_MESSAGES/glib20.mo +0 -0
  793. data/vendor/local/share/locale/ta/LC_MESSAGES/atk10.mo +0 -0
  794. data/vendor/local/share/locale/ta/LC_MESSAGES/glib20.mo +0 -0
  795. data/vendor/local/share/locale/te/LC_MESSAGES/atk10.mo +0 -0
  796. data/vendor/local/share/locale/te/LC_MESSAGES/glib20.mo +0 -0
  797. data/vendor/local/share/locale/th/LC_MESSAGES/atk10.mo +0 -0
  798. data/vendor/local/share/locale/th/LC_MESSAGES/glib20.mo +0 -0
  799. data/vendor/local/share/locale/tk/LC_MESSAGES/atk10.mo +0 -0
  800. data/vendor/local/share/locale/tl/LC_MESSAGES/glib20.mo +0 -0
  801. data/vendor/local/share/locale/tr/LC_MESSAGES/atk10.mo +0 -0
  802. data/vendor/local/share/locale/tr/LC_MESSAGES/gettext-runtime.mo +0 -0
  803. data/vendor/local/share/locale/tr/LC_MESSAGES/glib20.mo +0 -0
  804. data/vendor/local/share/locale/tt/LC_MESSAGES/atk10.mo +0 -0
  805. data/vendor/local/share/locale/tt/LC_MESSAGES/glib20.mo +0 -0
  806. data/vendor/local/share/locale/ug/LC_MESSAGES/atk10.mo +0 -0
  807. data/vendor/local/share/locale/uk/LC_MESSAGES/atk10.mo +0 -0
  808. data/vendor/local/share/locale/uk/LC_MESSAGES/gettext-runtime.mo +0 -0
  809. data/vendor/local/share/locale/uk/LC_MESSAGES/glib20.mo +0 -0
  810. data/vendor/local/share/locale/vi/LC_MESSAGES/atk10.mo +0 -0
  811. data/vendor/local/share/locale/vi/LC_MESSAGES/gettext-runtime.mo +0 -0
  812. data/vendor/local/share/locale/vi/LC_MESSAGES/glib20.mo +0 -0
  813. data/vendor/local/share/locale/wa/LC_MESSAGES/atk10.mo +0 -0
  814. data/vendor/local/share/locale/wa/LC_MESSAGES/glib20.mo +0 -0
  815. data/vendor/local/share/locale/xh/LC_MESSAGES/atk10.mo +0 -0
  816. data/vendor/local/share/locale/xh/LC_MESSAGES/glib20.mo +0 -0
  817. data/vendor/local/share/locale/yi/LC_MESSAGES/atk10.mo +0 -0
  818. data/vendor/local/share/locale/yi/LC_MESSAGES/glib20.mo +0 -0
  819. data/vendor/local/share/locale/zh_CN/LC_MESSAGES/atk10.mo +0 -0
  820. data/vendor/local/share/locale/zh_CN/LC_MESSAGES/gettext-runtime.mo +0 -0
  821. data/vendor/local/share/locale/zh_CN/LC_MESSAGES/glib20.mo +0 -0
  822. data/vendor/local/share/locale/zh_HK/LC_MESSAGES/atk10.mo +0 -0
  823. data/vendor/local/share/locale/zh_HK/LC_MESSAGES/gettext-runtime.mo +0 -0
  824. data/vendor/local/share/locale/zh_HK/LC_MESSAGES/glib20.mo +0 -0
  825. data/vendor/local/share/locale/zh_TW/LC_MESSAGES/atk10.mo +0 -0
  826. data/vendor/local/share/locale/zh_TW/LC_MESSAGES/gettext-runtime.mo +0 -0
  827. data/vendor/local/share/locale/zh_TW/LC_MESSAGES/glib20.mo +0 -0
  828. data/vendor/local/share/man/man1/envsubst.1 +54 -0
  829. data/vendor/local/share/man/man1/gettext.1 +69 -0
  830. data/vendor/local/share/man/man1/glib-genmarshal.1 +307 -0
  831. data/vendor/local/share/man/man1/glib-mkenums.1 +234 -0
  832. data/vendor/local/share/man/man1/gobject-query.1 +83 -0
  833. data/vendor/local/share/man/man1/ngettext.1 +68 -0
  834. data/vendor/local/share/man/man3/bind_textdomain_codeset.3 +72 -0
  835. data/vendor/local/share/man/man3/bindtextdomain.3 +69 -0
  836. data/vendor/local/share/man/man3/dcgettext.3 +1 -0
  837. data/vendor/local/share/man/man3/dcngettext.3 +1 -0
  838. data/vendor/local/share/man/man3/dgettext.3 +1 -0
  839. data/vendor/local/share/man/man3/dngettext.3 +1 -0
  840. data/vendor/local/share/man/man3/gettext.3 +99 -0
  841. data/vendor/local/share/man/man3/ngettext.3 +60 -0
  842. data/vendor/local/share/man/man3/textdomain.3 +57 -0
  843. data/vendor/local/src/tml/packaging/atk_1.30.0-2_win32.log +739 -0
  844. data/vendor/local/src/tml/packaging/atk_1.30.0-2_win32.sh +51 -0
  845. data/vendor/local/src/tml/packaging/gettext_0.18.1.1-2_win32.log +10423 -0
  846. data/vendor/local/src/tml/packaging/gettext_0.18.1.1-2_win32.sh +457 -0
  847. data/vendor/local/src/tml/packaging/glib_2.24.2-2_win32.log +2602 -0
  848. data/vendor/local/src/tml/packaging/glib_2.24.2-2_win32.sh +290 -0
  849. metadata +929 -0
@@ -0,0 +1,3411 @@
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>Threads</title>
6
+ <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
+ <link rel="home" href="index.html" title="GLib Reference Manual">
8
+ <link rel="up" href="glib-core.html" title="GLib Core Application Support">
9
+ <link rel="prev" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">
10
+ <link rel="next" href="glib-Thread-Pools.html" title="Thread Pools">
11
+ <meta name="generator" content="GTK-Doc V1.14 (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="glib-The-Main-Event-Loop.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
+ <td><a accesskey="u" href="glib-core.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">GLib Reference Manual</th>
21
+ <td><a accesskey="n" href="glib-Thread-Pools.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="#glib-Threads.synopsis" class="shortcut">Top</a>
25
+  | 
26
+ <a href="#glib-Threads.description" class="shortcut">Description</a>
27
+ </td></tr>
28
+ </table>
29
+ <div class="refentry" title="Threads">
30
+ <a name="glib-Threads"></a><div class="titlepage"></div>
31
+ <div class="refnamediv"><table width="100%"><tr>
32
+ <td valign="top">
33
+ <h2><span class="refentrytitle"><a name="glib-Threads.top_of_page"></a>Threads</span></h2>
34
+ <p>Threads — thread abstraction; including threads, different
35
+ mutexes, conditions and thread private data</p>
36
+ </td>
37
+ <td valign="top" align="right"></td>
38
+ </tr></table></div>
39
+ <div class="refsynopsisdiv" title="Synopsis">
40
+ <a name="glib-Threads.synopsis"></a><h2>Synopsis</h2>
41
+ <pre class="synopsis">
42
+ #include &lt;glib.h&gt;
43
+
44
+ #define <a class="link" href="glib-Threads.html#G-THREADS-ENABLED:CAPS" title="G_THREADS_ENABLED">G_THREADS_ENABLED</a>
45
+ #define <a class="link" href="glib-Threads.html#G-THREADS-IMPL-POSIX:CAPS" title="G_THREADS_IMPL_POSIX">G_THREADS_IMPL_POSIX</a>
46
+ #define <a class="link" href="glib-Threads.html#G-THREADS-IMPL-NONE:CAPS" title="G_THREADS_IMPL_NONE">G_THREADS_IMPL_NONE</a>
47
+
48
+ #define <a class="link" href="glib-Threads.html#G-THREAD-ERROR:CAPS" title="G_THREAD_ERROR">G_THREAD_ERROR</a>
49
+ enum <a class="link" href="glib-Threads.html#GThreadError" title="enum GThreadError">GThreadError</a>;
50
+
51
+ <a class="link" href="glib-Threads.html#GThreadFunctions" title="GThreadFunctions">GThreadFunctions</a>;
52
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()">g_thread_init</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunctions" title="GThreadFunctions"><span class="type">GThreadFunctions</span></a> *vtable</code></em>);
53
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-thread-supported" title="g_thread_supported ()">g_thread_supported</a> ();
54
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-thread-get-initialized" title="g_thread_get_initialized ()">g_thread_get_initialized</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
55
+
56
+ <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> (<a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()">*GThreadFunc</a>) (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
57
+ enum <a class="link" href="glib-Threads.html#GThreadPriority" title="enum GThreadPriority">GThreadPriority</a>;
58
+ <a class="link" href="glib-Threads.html#GThread" title="GThread">GThread</a>;
59
+ <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> * <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()">g_thread_create</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
60
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
61
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
62
+ <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> **error</code></em>);
63
+ <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a>* <a class="link" href="glib-Threads.html#g-thread-create-full" title="g_thread_create_full ()">g_thread_create_full</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
64
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
65
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> stack_size</code></em>,
66
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
67
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> bound</code></em>,
68
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>,
69
+ <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> **error</code></em>);
70
+ <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a>* <a class="link" href="glib-Threads.html#g-thread-self" title="g_thread_self ()">g_thread_self</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
71
+ <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()">g_thread_join</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>);
72
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-thread-set-priority" title="g_thread_set_priority ()">g_thread_set_priority</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>,
73
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>);
74
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-thread-yield" title="g_thread_yield ()">g_thread_yield</a> ();
75
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-thread-exit" title="g_thread_exit ()">g_thread_exit</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> retval</code></em>);
76
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-thread-foreach" title="g_thread_foreach ()">g_thread_foreach</a> (<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GFunc" title="GFunc ()"><span class="type">GFunc</span></a> thread_func</code></em>,
77
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
78
+
79
+ <a class="link" href="glib-Threads.html#GMutex" title="GMutex">GMutex</a>;
80
+ <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="returnvalue">GMutex</span></a> * <a class="link" href="glib-Threads.html#g-mutex-new" title="g_mutex_new ()">g_mutex_new</a> ();
81
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()">g_mutex_lock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);
82
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()">g_mutex_trylock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);
83
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()">g_mutex_unlock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);
84
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-mutex-free" title="g_mutex_free ()">g_mutex_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);
85
+
86
+ <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex">GStaticMutex</a>;
87
+ #define <a class="link" href="glib-Threads.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT">G_STATIC_MUTEX_INIT</a>
88
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-mutex-init" title="g_static_mutex_init ()">g_static_mutex_init</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
89
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-mutex-lock" title="g_static_mutex_lock ()">g_static_mutex_lock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
90
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-static-mutex-trylock" title="g_static_mutex_trylock ()">g_static_mutex_trylock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
91
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-mutex-unlock" title="g_static_mutex_unlock ()">g_static_mutex_unlock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
92
+ <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="returnvalue">GMutex</span></a> * <a class="link" href="glib-Threads.html#g-static-mutex-get-mutex" title="g_static_mutex_get_mutex ()">g_static_mutex_get_mutex</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
93
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-mutex-free" title="g_static_mutex_free ()">g_static_mutex_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);
94
+
95
+ #define <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()">G_LOCK_DEFINE</a> (name)
96
+ #define <a class="link" href="glib-Threads.html#G-LOCK-DEFINE-STATIC:CAPS" title="G_LOCK_DEFINE_STATIC()">G_LOCK_DEFINE_STATIC</a> (name)
97
+ #define <a class="link" href="glib-Threads.html#G-LOCK-EXTERN:CAPS" title="G_LOCK_EXTERN()">G_LOCK_EXTERN</a> (name)
98
+ #define <a class="link" href="glib-Threads.html#G-LOCK:CAPS" title="G_LOCK()">G_LOCK</a> (name)
99
+ #define <a class="link" href="glib-Threads.html#G-TRYLOCK:CAPS" title="G_TRYLOCK()">G_TRYLOCK</a> (name)
100
+ #define <a class="link" href="glib-Threads.html#G-UNLOCK:CAPS" title="G_UNLOCK()">G_UNLOCK</a> (name)
101
+
102
+ <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex">GStaticRecMutex</a>;
103
+ #define <a class="link" href="glib-Threads.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT">G_STATIC_REC_MUTEX_INIT</a>
104
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()">g_static_rec_mutex_init</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
105
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()">g_static_rec_mutex_lock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
106
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-static-rec-mutex-trylock" title="g_static_rec_mutex_trylock ()">g_static_rec_mutex_trylock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
107
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rec-mutex-unlock" title="g_static_rec_mutex_unlock ()">g_static_rec_mutex_unlock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
108
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()">g_static_rec_mutex_lock_full</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>,
109
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> depth</code></em>);
110
+ <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> <a class="link" href="glib-Threads.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()">g_static_rec_mutex_unlock_full</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
111
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rec-mutex-free" title="g_static_rec_mutex_free ()">g_static_rec_mutex_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);
112
+
113
+ <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock">GStaticRWLock</a>;
114
+ #define <a class="link" href="glib-Threads.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT">G_STATIC_RW_LOCK_INIT</a>
115
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()">g_static_rw_lock_init</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
116
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()">g_static_rw_lock_reader_lock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
117
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-trylock" title="g_static_rw_lock_reader_trylock ()">g_static_rw_lock_reader_trylock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
118
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()">g_static_rw_lock_reader_unlock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
119
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-writer-lock" title="g_static_rw_lock_writer_lock ()">g_static_rw_lock_writer_lock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
120
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-static-rw-lock-writer-trylock" title="g_static_rw_lock_writer_trylock ()">g_static_rw_lock_writer_trylock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
121
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()">g_static_rw_lock_writer_unlock</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
122
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-rw-lock-free" title="g_static_rw_lock_free ()">g_static_rw_lock_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);
123
+
124
+ <a class="link" href="glib-Threads.html#GCond" title="GCond">GCond</a>;
125
+ <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="returnvalue">GCond</span></a>* <a class="link" href="glib-Threads.html#g-cond-new" title="g_cond_new ()">g_cond_new</a> ();
126
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-cond-signal" title="g_cond_signal ()">g_cond_signal</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);
127
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-cond-broadcast" title="g_cond_broadcast ()">g_cond_broadcast</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);
128
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()">g_cond_wait</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>,
129
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);
130
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-cond-timed-wait" title="g_cond_timed_wait ()">g_cond_timed_wait</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>,
131
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>,
132
+ <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal"><span class="type">GTimeVal</span></a> *abs_time</code></em>);
133
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-cond-free" title="g_cond_free ()">g_cond_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);
134
+
135
+ <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate">GPrivate</a>;
136
+ <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="returnvalue">GPrivate</span></a>* <a class="link" href="glib-Threads.html#g-private-new" title="g_private_new ()">g_private_new</a> (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> destructor</code></em>);
137
+ <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()">g_private_get</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> *private_key</code></em>);
138
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-private-set" title="g_private_set ()">g_private_set</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> *private_key</code></em>,
139
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
140
+
141
+ <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate">GStaticPrivate</a>;
142
+ #define <a class="link" href="glib-Threads.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT">G_STATIC_PRIVATE_INIT</a>
143
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-private-init" title="g_static_private_init ()">g_static_private_init</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);
144
+ <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="glib-Threads.html#g-static-private-get" title="g_static_private_get ()">g_static_private_get</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);
145
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-private-set" title="g_static_private_set ()">g_static_private_set</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>,
146
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
147
+ <em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);
148
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-static-private-free" title="g_static_private_free ()">g_static_private_free</a> (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);
149
+
150
+ <a class="link" href="glib-Threads.html#GOnce" title="GOnce">GOnce</a>;
151
+ enum <a class="link" href="glib-Threads.html#GOnceStatus" title="enum GOnceStatus">GOnceStatus</a>;
152
+ #define <a class="link" href="glib-Threads.html#G-ONCE-INIT:CAPS" title="G_ONCE_INIT">G_ONCE_INIT</a>
153
+ #define <a class="link" href="glib-Threads.html#g-once" title="g_once()">g_once</a> (once,
154
+ func,
155
+ arg)
156
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-once-init-enter" title="g_once_init_enter ()">g_once_init_enter</a> (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *value_location</code></em>);
157
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-once-init-leave" title="g_once_init_leave ()">g_once_init_leave</a> (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *value_location</code></em>,
158
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> initialization_value</code></em>);
159
+
160
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-bit-lock" title="g_bit_lock ()">g_bit_lock</a> (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
161
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);
162
+ <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-Threads.html#g-bit-trylock" title="g_bit_trylock ()">g_bit_trylock</a> (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
163
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);
164
+ <span class="returnvalue">void</span> <a class="link" href="glib-Threads.html#g-bit-unlock" title="g_bit_unlock ()">g_bit_unlock</a> (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
165
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);
166
+ </pre>
167
+ </div>
168
+ <div class="refsect1" title="Description">
169
+ <a name="glib-Threads.description"></a><h2>Description</h2>
170
+ <p>
171
+ Threads act almost like processes, but unlike processes all threads
172
+ of one process share the same memory. This is good, as it provides
173
+ easy communication between the involved threads via this shared
174
+ memory, and it is bad, because strange things (so called
175
+ "Heisenbugs") might happen if the program is not carefully designed.
176
+ In particular, due to the concurrent nature of threads, no
177
+ assumptions on the order of execution of code running in different
178
+ threads can be made, unless order is explicitly forced by the
179
+ programmer through synchronization primitives.
180
+ </p>
181
+ <p>
182
+ The aim of the thread related functions in GLib is to provide a
183
+ portable means for writing multi-threaded software. There are
184
+ primitives for mutexes to protect the access to portions of memory
185
+ (<a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a>, <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> and
186
+ <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a>). There are primitives for condition variables to
187
+ allow synchronization of threads (<a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>). There are primitives for
188
+ thread-private data - data that every thread has a private instance
189
+ of (<a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>, <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>). Last but definitely not least there
190
+ are primitives to portably create and manage threads (<a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>).
191
+ </p>
192
+ <p>
193
+ The threading system is initialized with <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, which
194
+ takes an optional custom thread implementation or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for the
195
+ default implementation. If you want to call <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> with a
196
+ non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> argument this must be done before executing any other GLib
197
+ functions (except <a class="link" href="glib-Memory-Allocation.html#g-mem-set-vtable" title="g_mem_set_vtable ()"><code class="function">g_mem_set_vtable()</code></a>). This is a requirement even if
198
+ no threads are in fact ever created by the process.
199
+ </p>
200
+ <p>
201
+ Calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> with a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> argument is somewhat more
202
+ relaxed. You may call any other glib functions in the main thread
203
+ before <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> as long as <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> is not called from
204
+ a glib callback, or with any locks held. However, many libraries
205
+ above glib does not support late initialization of threads, so doing
206
+ this should be avoided if possible.
207
+ </p>
208
+ <p>
209
+ Please note that since version 2.24 the GObject initialization
210
+ function <a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a> initializes threads (with a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> argument),
211
+ so most applications, including those using Gtk+ will run with
212
+ threads enabled. If you want a special thread implementation, make
213
+ sure you call <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> before <a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a> is called.
214
+ </p>
215
+ <p>
216
+ After calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, GLib is completely thread safe (all
217
+ global data is automatically locked), but individual data structure
218
+ instances are not automatically locked for performance reasons. So,
219
+ for example you must coordinate accesses to the same <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
220
+ from multiple threads. The two notable exceptions from this rule
221
+ are <a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop" title="GMainLoop"><span class="type">GMainLoop</span></a> and <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>, which <span class="emphasis"><em>are</em></span>
222
+ threadsafe and need no further application-level locking to be
223
+ accessed from multiple threads.
224
+ </p>
225
+ <p>
226
+ To help debugging problems in multithreaded applications, GLib
227
+ supports error-checking mutexes that will give you helpful error
228
+ messages on common problems. To use error-checking mutexes, define
229
+ the symbol <span class="type">G_ERRORCHECK_MUTEXES</span> when compiling the application.
230
+ </p>
231
+ </div>
232
+ <div class="refsect1" title="Details">
233
+ <a name="glib-Threads.details"></a><h2>Details</h2>
234
+ <div class="refsect2" title="G_THREADS_ENABLED">
235
+ <a name="G-THREADS-ENABLED:CAPS"></a><h3>G_THREADS_ENABLED</h3>
236
+ <pre class="programlisting">#define G_THREADS_ENABLED
237
+ </pre>
238
+ <p>
239
+ This macro is defined if GLib was compiled with thread support. This
240
+ does not necessarily mean that there is a thread implementation
241
+ available, but it does mean that the infrastructure is in place and
242
+ that once you provide a thread implementation to <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>,
243
+ GLib will be multi-thread safe. If <a class="link" href="glib-Threads.html#G-THREADS-ENABLED:CAPS" title="G_THREADS_ENABLED"><span class="type">G_THREADS_ENABLED</span></a> is not
244
+ defined, then Glib is not, and cannot be, multi-thread safe.
245
+ </p>
246
+ </div>
247
+ <hr>
248
+ <div class="refsect2" title="G_THREADS_IMPL_POSIX">
249
+ <a name="G-THREADS-IMPL-POSIX:CAPS"></a><h3>G_THREADS_IMPL_POSIX</h3>
250
+ <pre class="programlisting">#define G_THREADS_IMPL_POSIX
251
+ </pre>
252
+ <p>
253
+ This macro is defined if POSIX style threads are used.
254
+ </p>
255
+ </div>
256
+ <hr>
257
+ <div class="refsect2" title="G_THREADS_IMPL_NONE">
258
+ <a name="G-THREADS-IMPL-NONE:CAPS"></a><h3>G_THREADS_IMPL_NONE</h3>
259
+ <pre class="programlisting">#define G_THREADS_IMPL_NONE
260
+ </pre>
261
+ <p>
262
+ This macro is defined if no thread implementation is used. You can,
263
+ however, provide one to <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> to make GLib multi-thread
264
+ safe.
265
+ </p>
266
+ </div>
267
+ <hr>
268
+ <div class="refsect2" title="G_THREAD_ERROR">
269
+ <a name="G-THREAD-ERROR:CAPS"></a><h3>G_THREAD_ERROR</h3>
270
+ <pre class="programlisting">#define G_THREAD_ERROR g_thread_error_quark ()
271
+ </pre>
272
+ <p>
273
+ The error domain of the GLib thread subsystem.
274
+ </p>
275
+ </div>
276
+ <hr>
277
+ <div class="refsect2" title="enum GThreadError">
278
+ <a name="GThreadError"></a><h3>enum GThreadError</h3>
279
+ <pre class="programlisting">typedef enum
280
+ {
281
+ G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
282
+ } GThreadError;
283
+ </pre>
284
+ <p>
285
+ Possible errors of thread related functions.
286
+ </p>
287
+ <div class="variablelist"><table border="0">
288
+ <col align="left" valign="top">
289
+ <tbody><tr>
290
+ <td><p><a name="G-THREAD-ERROR-AGAIN:CAPS"></a><span class="term"><code class="literal">G_THREAD_ERROR_AGAIN</code></span></p></td>
291
+ <td>a thread couldn't be created due to resource
292
+ shortage. Try again later.
293
+ </td>
294
+ </tr></tbody>
295
+ </table></div>
296
+ </div>
297
+ <hr>
298
+ <div class="refsect2" title="GThreadFunctions">
299
+ <a name="GThreadFunctions"></a><h3>GThreadFunctions</h3>
300
+ <pre class="programlisting">typedef struct {
301
+ GMutex* (*mutex_new) (void);
302
+ void (*mutex_lock) (GMutex *mutex);
303
+ gboolean (*mutex_trylock) (GMutex *mutex);
304
+ void (*mutex_unlock) (GMutex *mutex);
305
+ void (*mutex_free) (GMutex *mutex);
306
+ GCond* (*cond_new) (void);
307
+ void (*cond_signal) (GCond *cond);
308
+ void (*cond_broadcast) (GCond *cond);
309
+ void (*cond_wait) (GCond *cond,
310
+ GMutex *mutex);
311
+ gboolean (*cond_timed_wait) (GCond *cond,
312
+ GMutex *mutex,
313
+ GTimeVal *end_time);
314
+ void (*cond_free) (GCond *cond);
315
+ GPrivate* (*private_new) (GDestroyNotify destructor);
316
+ gpointer (*private_get) (GPrivate *private_key);
317
+ void (*private_set) (GPrivate *private_key,
318
+ gpointer data);
319
+ void (*thread_create) (GThreadFunc func,
320
+ gpointer data,
321
+ gulong stack_size,
322
+ gboolean joinable,
323
+ gboolean bound,
324
+ GThreadPriority priority,
325
+ gpointer thread,
326
+ GError **error);
327
+ void (*thread_yield) (void);
328
+ void (*thread_join) (gpointer thread);
329
+ void (*thread_exit) (void);
330
+ void (*thread_set_priority)(gpointer thread,
331
+ GThreadPriority priority);
332
+ void (*thread_self) (gpointer thread);
333
+ gboolean (*thread_equal) (gpointer thread1,
334
+ gpointer thread2);
335
+ } GThreadFunctions;
336
+ </pre>
337
+ <p>
338
+ This function table is used by <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> to initialize the
339
+ thread system. The functions in the table are directly used by their
340
+ g_* prepended counterparts (described in this document). For
341
+ example, if you call <a class="link" href="glib-Threads.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a> then <code class="function">mutex_new()</code> from the table
342
+ provided to <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> will be called.
343
+ </p>
344
+ <p>
345
+ </p>
346
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
347
+ <h3 class="title">Note</h3>
348
+ <p>Do not use this struct unless you know what you are
349
+ doing.</p>
350
+ </div>
351
+ <p>
352
+ </p>
353
+ <div class="variablelist"><table border="0">
354
+ <col align="left" valign="top">
355
+ <tbody>
356
+ <tr>
357
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.mutex-new"></a>mutex_new</code></em> ()</span></p></td>
358
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a>
359
+ </td>
360
+ </tr>
361
+ <tr>
362
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.mutex-lock"></a>mutex_lock</code></em> ()</span></p></td>
363
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>
364
+ </td>
365
+ </tr>
366
+ <tr>
367
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.mutex-trylock"></a>mutex_trylock</code></em> ()</span></p></td>
368
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a>
369
+ </td>
370
+ </tr>
371
+ <tr>
372
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.mutex-unlock"></a>mutex_unlock</code></em> ()</span></p></td>
373
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a>
374
+ </td>
375
+ </tr>
376
+ <tr>
377
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.mutex-free"></a>mutex_free</code></em> ()</span></p></td>
378
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a>
379
+ </td>
380
+ </tr>
381
+ <tr>
382
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-new"></a>cond_new</code></em> ()</span></p></td>
383
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-new" title="g_cond_new ()"><code class="function">g_cond_new()</code></a>
384
+ </td>
385
+ </tr>
386
+ <tr>
387
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-signal"></a>cond_signal</code></em> ()</span></p></td>
388
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-signal" title="g_cond_signal ()"><code class="function">g_cond_signal()</code></a>
389
+ </td>
390
+ </tr>
391
+ <tr>
392
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-broadcast"></a>cond_broadcast</code></em> ()</span></p></td>
393
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-broadcast" title="g_cond_broadcast ()"><code class="function">g_cond_broadcast()</code></a>
394
+ </td>
395
+ </tr>
396
+ <tr>
397
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-wait"></a>cond_wait</code></em> ()</span></p></td>
398
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a>
399
+ </td>
400
+ </tr>
401
+ <tr>
402
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-timed-wait"></a>cond_timed_wait</code></em> ()</span></p></td>
403
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-timed-wait" title="g_cond_timed_wait ()"><code class="function">g_cond_timed_wait()</code></a>
404
+ </td>
405
+ </tr>
406
+ <tr>
407
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.cond-free"></a>cond_free</code></em> ()</span></p></td>
408
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-cond-free" title="g_cond_free ()"><code class="function">g_cond_free()</code></a>
409
+ </td>
410
+ </tr>
411
+ <tr>
412
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.private-new"></a>private_new</code></em> ()</span></p></td>
413
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-private-new" title="g_private_new ()"><code class="function">g_private_new()</code></a>
414
+ </td>
415
+ </tr>
416
+ <tr>
417
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.private-get"></a>private_get</code></em> ()</span></p></td>
418
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()"><code class="function">g_private_get()</code></a>
419
+ </td>
420
+ </tr>
421
+ <tr>
422
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.private-set"></a>private_set</code></em> ()</span></p></td>
423
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-private-set" title="g_private_set ()"><code class="function">g_private_set()</code></a>
424
+ </td>
425
+ </tr>
426
+ <tr>
427
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-create"></a>thread_create</code></em> ()</span></p></td>
428
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>
429
+ </td>
430
+ </tr>
431
+ <tr>
432
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-yield"></a>thread_yield</code></em> ()</span></p></td>
433
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-thread-yield" title="g_thread_yield ()"><code class="function">g_thread_yield()</code></a>
434
+ </td>
435
+ </tr>
436
+ <tr>
437
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-join"></a>thread_join</code></em> ()</span></p></td>
438
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>
439
+ </td>
440
+ </tr>
441
+ <tr>
442
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-exit"></a>thread_exit</code></em> ()</span></p></td>
443
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-thread-exit" title="g_thread_exit ()"><code class="function">g_thread_exit()</code></a>
444
+ </td>
445
+ </tr>
446
+ <tr>
447
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-set-priority"></a>thread_set_priority</code></em> ()</span></p></td>
448
+ <td>virtual function pointer for
449
+ <a class="link" href="glib-Threads.html#g-thread-set-priority" title="g_thread_set_priority ()"><code class="function">g_thread_set_priority()</code></a>
450
+ </td>
451
+ </tr>
452
+ <tr>
453
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-self"></a>thread_self</code></em> ()</span></p></td>
454
+ <td>virtual function pointer for <a class="link" href="glib-Threads.html#g-thread-self" title="g_thread_self ()"><code class="function">g_thread_self()</code></a>
455
+ </td>
456
+ </tr>
457
+ <tr>
458
+ <td><p><span class="term"><em class="structfield"><code><a name="GThreadFunctions.thread-equal"></a>thread_equal</code></em> ()</span></p></td>
459
+ <td>used internally by recursive mutex locks and by some
460
+ assertion checks
461
+ </td>
462
+ </tr>
463
+ </tbody>
464
+ </table></div>
465
+ </div>
466
+ <hr>
467
+ <div class="refsect2" title="g_thread_init ()">
468
+ <a name="g-thread-init"></a><h3>g_thread_init ()</h3>
469
+ <pre class="programlisting"><span class="returnvalue">void</span> g_thread_init (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunctions" title="GThreadFunctions"><span class="type">GThreadFunctions</span></a> *vtable</code></em>);</pre>
470
+ <p>
471
+ If you use GLib from more than one thread, you must initialize the
472
+ thread system by calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>. Most of the time you will
473
+ only have to call <code class="literal">g_thread_init (NULL)</code>.
474
+ </p>
475
+ <p>
476
+ </p>
477
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
478
+ <h3 class="title">Note</h3>
479
+ <p>Do not call <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> with a non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> parameter unless
480
+ you really know what you are doing.</p>
481
+ </div>
482
+ <p>
483
+ </p>
484
+ <p>
485
+ </p>
486
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
487
+ <h3 class="title">Note</h3>
488
+ <p><a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> must not be called directly or indirectly as a
489
+ callback from GLib. Also no mutexes may be currently locked while
490
+ calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</p>
491
+ </div>
492
+ <p>
493
+ </p>
494
+ <p>
495
+ </p>
496
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
497
+ <h3 class="title">Note</h3>
498
+ <p><a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> changes the way in which <a class="link" href="glib-Timers.html#GTimer" title="GTimer"><span class="type">GTimer</span></a> measures
499
+ elapsed time. As a consequence, timers that are running while
500
+ <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> is called may report unreliable times.</p>
501
+ </div>
502
+ <p>
503
+ </p>
504
+ <p>
505
+ Calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> multiple times is allowed (since version
506
+ 2.24), but nothing happens except for the first call. If the
507
+ argument is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> on such a call a warning will be printed, but
508
+ otherwise the argument is ignored.
509
+ </p>
510
+ <p>
511
+ If no thread system is available and <em class="parameter"><code>vtable</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> or if not all
512
+ elements of <em class="parameter"><code>vtable</code></em> are non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> will abort.
513
+ </p>
514
+ <p>
515
+ </p>
516
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
517
+ <h3 class="title">Note</h3>
518
+ <p>To use <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> in your program, you have to link with
519
+ the libraries that the command <span class="command"><strong>pkg-config --libs
520
+ gthread-2.0</strong></span> outputs. This is not the case for all the
521
+ other thread related functions of GLib. Those can be used without
522
+ having to link with the thread libraries.</p>
523
+ </div>
524
+ <p>
525
+ </p>
526
+ <div class="variablelist"><table border="0">
527
+ <col align="left" valign="top">
528
+ <tbody><tr>
529
+ <td><p><span class="term"><em class="parameter"><code>vtable</code></em> :</span></p></td>
530
+ <td>a function table of type <a class="link" href="glib-Threads.html#GThreadFunctions" title="GThreadFunctions"><span class="type">GThreadFunctions</span></a>, that provides
531
+ the entry points to the thread system to be used.
532
+ </td>
533
+ </tr></tbody>
534
+ </table></div>
535
+ </div>
536
+ <hr>
537
+ <div class="refsect2" title="g_thread_supported ()">
538
+ <a name="g-thread-supported"></a><h3>g_thread_supported ()</h3>
539
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_thread_supported ();</pre>
540
+ <p>
541
+ This function returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the thread system is initialized, and
542
+ <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if it is not.
543
+ </p>
544
+ <p>
545
+ </p>
546
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
547
+ <h3 class="title">Note</h3>
548
+ <p>This function is actually a macro. Apart from taking the
549
+ address of it you can however use it as if it was a
550
+ function.</p>
551
+ </div>
552
+ <p>
553
+ </p>
554
+ <div class="variablelist"><table border="0">
555
+ <col align="left" valign="top">
556
+ <tbody><tr>
557
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
558
+ <td>
559
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the thread system is initialized.
560
+ </td>
561
+ </tr></tbody>
562
+ </table></div>
563
+ </div>
564
+ <hr>
565
+ <div class="refsect2" title="g_thread_get_initialized ()">
566
+ <a name="g-thread-get-initialized"></a><h3>g_thread_get_initialized ()</h3>
567
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_thread_get_initialized (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
568
+ <p>
569
+ Indicates if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has been called.
570
+ </p>
571
+ <div class="variablelist"><table border="0">
572
+ <col align="left" valign="top">
573
+ <tbody><tr>
574
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
575
+ <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if threads have been initialized.
576
+
577
+ </td>
578
+ </tr></tbody>
579
+ </table></div>
580
+ <p class="since">Since 2.20</p>
581
+ </div>
582
+ <hr>
583
+ <div class="refsect2" title="GThreadFunc ()">
584
+ <a name="GThreadFunc"></a><h3>GThreadFunc ()</h3>
585
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> (*GThreadFunc) (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
586
+ <p>
587
+ Specifies the type of the <em class="parameter"><code>func</code></em> functions passed to
588
+ <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a> or <a class="link" href="glib-Threads.html#g-thread-create-full" title="g_thread_create_full ()"><code class="function">g_thread_create_full()</code></a>.
589
+ </p>
590
+ <div class="variablelist"><table border="0">
591
+ <col align="left" valign="top">
592
+ <tbody>
593
+ <tr>
594
+ <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
595
+ <td>data passed to the thread.
596
+ </td>
597
+ </tr>
598
+ <tr>
599
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
600
+ <td>the return value of the thread, which will be returned by
601
+ <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>.
602
+ </td>
603
+ </tr>
604
+ </tbody>
605
+ </table></div>
606
+ </div>
607
+ <hr>
608
+ <div class="refsect2" title="enum GThreadPriority">
609
+ <a name="GThreadPriority"></a><h3>enum GThreadPriority</h3>
610
+ <pre class="programlisting">typedef enum
611
+ {
612
+ G_THREAD_PRIORITY_LOW,
613
+ G_THREAD_PRIORITY_NORMAL,
614
+ G_THREAD_PRIORITY_HIGH,
615
+ G_THREAD_PRIORITY_URGENT
616
+ } GThreadPriority;
617
+ </pre>
618
+ <p>
619
+ Specifies the priority of a thread.
620
+ </p>
621
+ <p>
622
+ </p>
623
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
624
+ <h3 class="title">Note</h3>
625
+ <p>It is not guaranteed that threads with different priorities
626
+ really behave accordingly. On some systems (e.g. Linux) there are no
627
+ thread priorities. On other systems (e.g. Solaris) there doesn't
628
+ seem to be different scheduling for different priorities. All in all
629
+ try to avoid being dependent on priorities.</p>
630
+ </div>
631
+ <p>
632
+ </p>
633
+ <div class="variablelist"><table border="0">
634
+ <col align="left" valign="top">
635
+ <tbody>
636
+ <tr>
637
+ <td><p><a name="G-THREAD-PRIORITY-LOW:CAPS"></a><span class="term"><code class="literal">G_THREAD_PRIORITY_LOW</code></span></p></td>
638
+ <td>a priority lower than normal
639
+ </td>
640
+ </tr>
641
+ <tr>
642
+ <td><p><a name="G-THREAD-PRIORITY-NORMAL:CAPS"></a><span class="term"><code class="literal">G_THREAD_PRIORITY_NORMAL</code></span></p></td>
643
+ <td>the default priority
644
+ </td>
645
+ </tr>
646
+ <tr>
647
+ <td><p><a name="G-THREAD-PRIORITY-HIGH:CAPS"></a><span class="term"><code class="literal">G_THREAD_PRIORITY_HIGH</code></span></p></td>
648
+ <td>a priority higher than normal
649
+ </td>
650
+ </tr>
651
+ <tr>
652
+ <td><p><a name="G-THREAD-PRIORITY-URGENT:CAPS"></a><span class="term"><code class="literal">G_THREAD_PRIORITY_URGENT</code></span></p></td>
653
+ <td>the highest priority
654
+ </td>
655
+ </tr>
656
+ </tbody>
657
+ </table></div>
658
+ </div>
659
+ <hr>
660
+ <div class="refsect2" title="GThread">
661
+ <a name="GThread"></a><h3>GThread</h3>
662
+ <pre class="programlisting">typedef struct {
663
+ } GThread;
664
+ </pre>
665
+ <p>
666
+ The <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> struct represents a running thread. It has three public
667
+ read-only members, but the underlying struct is bigger, so you must
668
+ not copy this struct.
669
+ </p>
670
+ <p>
671
+ </p>
672
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
673
+ <h3 class="title">Note</h3>
674
+ <p>Resources for a joinable thread are not fully released
675
+ until <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a> is called for that thread.</p>
676
+ </div>
677
+ <p>
678
+ </p>
679
+ </div>
680
+ <hr>
681
+ <div class="refsect2" title="g_thread_create ()">
682
+ <a name="g-thread-create"></a><h3>g_thread_create ()</h3>
683
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> * g_thread_create (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
684
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
685
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
686
+ <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> **error</code></em>);</pre>
687
+ <p>
688
+ This function creates a new thread with the default priority.
689
+ </p>
690
+ <p>
691
+ If <em class="parameter"><code>joinable</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, you can wait for this threads termination
692
+ calling <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>. Otherwise the thread will just disappear
693
+ when it terminates.
694
+ </p>
695
+ <p>
696
+ The new thread executes the function <em class="parameter"><code>func</code></em> with the argument <em class="parameter"><code>data</code></em>.
697
+ If the thread was created successfully, it is returned.
698
+ </p>
699
+ <p>
700
+ <em class="parameter"><code>error</code></em> can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors, or non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to report errors.
701
+ The error is set, if and only if the function returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
702
+ </p>
703
+ <div class="variablelist"><table border="0">
704
+ <col align="left" valign="top">
705
+ <tbody>
706
+ <tr>
707
+ <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
708
+ <td>a function to execute in the new thread.
709
+ </td>
710
+ </tr>
711
+ <tr>
712
+ <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
713
+ <td>an argument to supply to the new thread.
714
+ </td>
715
+ </tr>
716
+ <tr>
717
+ <td><p><span class="term"><em class="parameter"><code>joinable</code></em> :</span></p></td>
718
+ <td>should this thread be joinable?
719
+ </td>
720
+ </tr>
721
+ <tr>
722
+ <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
723
+ <td>return location for error.
724
+ </td>
725
+ </tr>
726
+ <tr>
727
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
728
+ <td>the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success.
729
+ </td>
730
+ </tr>
731
+ </tbody>
732
+ </table></div>
733
+ </div>
734
+ <hr>
735
+ <div class="refsect2" title="g_thread_create_full ()">
736
+ <a name="g-thread-create-full"></a><h3>g_thread_create_full ()</h3>
737
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a>* g_thread_create_full (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
738
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
739
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> stack_size</code></em>,
740
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
741
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> bound</code></em>,
742
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>,
743
+ <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> **error</code></em>);</pre>
744
+ <p>
745
+ This function creates a new thread with the priority <em class="parameter"><code>priority</code></em>. If
746
+ the underlying thread implementation supports it, the thread gets a
747
+ stack size of <em class="parameter"><code>stack_size</code></em> or the default value for the current
748
+ platform, if <em class="parameter"><code>stack_size</code></em> is 0.
749
+ </p>
750
+ <p>
751
+ If <em class="parameter"><code>joinable</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, you can wait for this threads termination
752
+ calling <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>. Otherwise the thread will just disappear
753
+ when it terminates. If <em class="parameter"><code>bound</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, this thread will be
754
+ scheduled in the system scope, otherwise the implementation is free
755
+ to do scheduling in the process scope. The first variant is more
756
+ expensive resource-wise, but generally faster. On some systems (e.g.
757
+ Linux) all threads are bound.
758
+ </p>
759
+ <p>
760
+ The new thread executes the function <em class="parameter"><code>func</code></em> with the argument <em class="parameter"><code>data</code></em>.
761
+ If the thread was created successfully, it is returned.
762
+ </p>
763
+ <p>
764
+ <em class="parameter"><code>error</code></em> can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors, or non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to report errors.
765
+ The error is set, if and only if the function returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
766
+ </p>
767
+ <p>
768
+ </p>
769
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
770
+ <h3 class="title">Note</h3>
771
+ <p>It is not guaranteed that threads with different priorities
772
+ really behave accordingly. On some systems (e.g. Linux) there are no
773
+ thread priorities. On other systems (e.g. Solaris) there doesn't
774
+ seem to be different scheduling for different priorities. All in all
775
+ try to avoid being dependent on priorities. Use
776
+ <a class="link" href="glib-Threads.html#G-THREAD-PRIORITY-NORMAL:CAPS"><code class="literal">G_THREAD_PRIORITY_NORMAL</code></a> here as a default.</p>
777
+ </div>
778
+ <p>
779
+ </p>
780
+ <p>
781
+ </p>
782
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
783
+ <h3 class="title">Note</h3>
784
+ <p>Only use <a class="link" href="glib-Threads.html#g-thread-create-full" title="g_thread_create_full ()"><code class="function">g_thread_create_full()</code></a> if you really can't use
785
+ <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a> instead. <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a> does not take
786
+ <em class="parameter"><code>stack_size</code></em>, <em class="parameter"><code>bound</code></em>, and <em class="parameter"><code>priority</code></em> as arguments, as they should only
787
+ be used in cases in which it is unavoidable.</p>
788
+ </div>
789
+ <p>
790
+ </p>
791
+ <div class="variablelist"><table border="0">
792
+ <col align="left" valign="top">
793
+ <tbody>
794
+ <tr>
795
+ <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
796
+ <td>a function to execute in the new thread.
797
+ </td>
798
+ </tr>
799
+ <tr>
800
+ <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
801
+ <td>an argument to supply to the new thread.
802
+ </td>
803
+ </tr>
804
+ <tr>
805
+ <td><p><span class="term"><em class="parameter"><code>stack_size</code></em> :</span></p></td>
806
+ <td>a stack size for the new thread.
807
+ </td>
808
+ </tr>
809
+ <tr>
810
+ <td><p><span class="term"><em class="parameter"><code>joinable</code></em> :</span></p></td>
811
+ <td>should this thread be joinable?
812
+ </td>
813
+ </tr>
814
+ <tr>
815
+ <td><p><span class="term"><em class="parameter"><code>bound</code></em> :</span></p></td>
816
+ <td>should this thread be bound to a system thread?
817
+ </td>
818
+ </tr>
819
+ <tr>
820
+ <td><p><span class="term"><em class="parameter"><code>priority</code></em> :</span></p></td>
821
+ <td>a priority for the thread.
822
+ </td>
823
+ </tr>
824
+ <tr>
825
+ <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
826
+ <td>return location for error.
827
+ </td>
828
+ </tr>
829
+ <tr>
830
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
831
+ <td>the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success.
832
+ </td>
833
+ </tr>
834
+ </tbody>
835
+ </table></div>
836
+ </div>
837
+ <hr>
838
+ <div class="refsect2" title="g_thread_self ()">
839
+ <a name="g-thread-self"></a><h3>g_thread_self ()</h3>
840
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a>* g_thread_self (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
841
+ <p>
842
+ This functions returns the <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> corresponding to the calling
843
+ thread.
844
+ </p>
845
+ <div class="variablelist"><table border="0">
846
+ <col align="left" valign="top">
847
+ <tbody><tr>
848
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
849
+ <td>the current thread.
850
+ </td>
851
+ </tr></tbody>
852
+ </table></div>
853
+ </div>
854
+ <hr>
855
+ <div class="refsect2" title="g_thread_join ()">
856
+ <a name="g-thread-join"></a><h3>g_thread_join ()</h3>
857
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> g_thread_join (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>);</pre>
858
+ <p>
859
+ Waits until <em class="parameter"><code>thread</code></em> finishes, i.e. the function <em class="parameter"><code>func</code></em>, as given to
860
+ <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>, returns or <a class="link" href="glib-Threads.html#g-thread-exit" title="g_thread_exit ()"><code class="function">g_thread_exit()</code></a> is called by <em class="parameter"><code>thread</code></em>.
861
+ All resources of <em class="parameter"><code>thread</code></em> including the <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> struct are released.
862
+ <em class="parameter"><code>thread</code></em> must have been created with <em class="parameter"><code>joinable</code></em>=<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> in
863
+ <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>. The value returned by <em class="parameter"><code>func</code></em> or given to
864
+ <a class="link" href="glib-Threads.html#g-thread-exit" title="g_thread_exit ()"><code class="function">g_thread_exit()</code></a> by <em class="parameter"><code>thread</code></em> is returned by this function.
865
+ </p>
866
+ <div class="variablelist"><table border="0">
867
+ <col align="left" valign="top">
868
+ <tbody>
869
+ <tr>
870
+ <td><p><span class="term"><em class="parameter"><code>thread</code></em> :</span></p></td>
871
+ <td>a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> to be waited for.
872
+ </td>
873
+ </tr>
874
+ <tr>
875
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
876
+ <td>the return value of the thread.
877
+ </td>
878
+ </tr>
879
+ </tbody>
880
+ </table></div>
881
+ </div>
882
+ <hr>
883
+ <div class="refsect2" title="g_thread_set_priority ()">
884
+ <a name="g-thread-set-priority"></a><h3>g_thread_set_priority ()</h3>
885
+ <pre class="programlisting"><span class="returnvalue">void</span> g_thread_set_priority (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>,
886
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>);</pre>
887
+ <p>
888
+ Changes the priority of <em class="parameter"><code>thread</code></em> to <em class="parameter"><code>priority</code></em>.
889
+ </p>
890
+ <p>
891
+ </p>
892
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
893
+ <h3 class="title">Note</h3>
894
+ <p>It is not guaranteed that threads with different
895
+ priorities really behave accordingly. On some systems (e.g. Linux)
896
+ there are no thread priorities. On other systems (e.g. Solaris) there
897
+ doesn't seem to be different scheduling for different priorities. All
898
+ in all try to avoid being dependent on priorities.</p>
899
+ </div>
900
+ <p>
901
+ </p>
902
+ <div class="variablelist"><table border="0">
903
+ <col align="left" valign="top">
904
+ <tbody>
905
+ <tr>
906
+ <td><p><span class="term"><em class="parameter"><code>thread</code></em> :</span></p></td>
907
+ <td>a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>.
908
+ </td>
909
+ </tr>
910
+ <tr>
911
+ <td><p><span class="term"><em class="parameter"><code>priority</code></em> :</span></p></td>
912
+ <td>a new priority for <em class="parameter"><code>thread</code></em>.
913
+ </td>
914
+ </tr>
915
+ </tbody>
916
+ </table></div>
917
+ </div>
918
+ <hr>
919
+ <div class="refsect2" title="g_thread_yield ()">
920
+ <a name="g-thread-yield"></a><h3>g_thread_yield ()</h3>
921
+ <pre class="programlisting"><span class="returnvalue">void</span> g_thread_yield ();</pre>
922
+ <p>
923
+ Gives way to other threads waiting to be scheduled.
924
+ </p>
925
+ <p>
926
+ This function is often used as a method to make busy wait less evil.
927
+ But in most cases you will encounter, there are better methods to do
928
+ that. So in general you shouldn't use this function.
929
+ </p>
930
+ </div>
931
+ <hr>
932
+ <div class="refsect2" title="g_thread_exit ()">
933
+ <a name="g-thread-exit"></a><h3>g_thread_exit ()</h3>
934
+ <pre class="programlisting"><span class="returnvalue">void</span> g_thread_exit (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> retval</code></em>);</pre>
935
+ <p>
936
+ Exits the current thread. If another thread is waiting for that
937
+ thread using <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a> and the current thread is joinable, the
938
+ waiting thread will be woken up and get <em class="parameter"><code>retval</code></em> as the return value
939
+ of <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>. If the current thread is not joinable, <em class="parameter"><code>retval</code></em>
940
+ is ignored. Calling
941
+ </p>
942
+ <p>
943
+ </p>
944
+ <div class="informalexample">
945
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
946
+ <tbody>
947
+ <tr>
948
+ <td class="listing_lines" align="right"><pre>1</pre></td>
949
+ <td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-Threads.html#g-thread-exit">g_thread_exit</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">retval</span><span class="symbol">);</span></pre></td>
950
+ </tr>
951
+ </tbody>
952
+ </table>
953
+ </div>
954
+
955
+ <p>
956
+ </p>
957
+ <p>
958
+ is equivalent to returning <em class="parameter"><code>retval</code></em> from the function <em class="parameter"><code>func</code></em>, as given
959
+ to <a class="link" href="glib-Threads.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>.
960
+ </p>
961
+ <p>
962
+ </p>
963
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
964
+ <h3 class="title">Note</h3>
965
+ <p>Never call <a class="link" href="glib-Threads.html#g-thread-exit" title="g_thread_exit ()"><code class="function">g_thread_exit()</code></a> from within a thread of a
966
+ <a class="link" href="glib-Thread-Pools.html#GThreadPool" title="GThreadPool"><span class="type">GThreadPool</span></a>, as that will mess up the bookkeeping and lead to funny
967
+ and unwanted results.</p>
968
+ </div>
969
+ <p>
970
+ </p>
971
+ <div class="variablelist"><table border="0">
972
+ <col align="left" valign="top">
973
+ <tbody><tr>
974
+ <td><p><span class="term"><em class="parameter"><code>retval</code></em> :</span></p></td>
975
+ <td>the return value of this thread.
976
+ </td>
977
+ </tr></tbody>
978
+ </table></div>
979
+ </div>
980
+ <hr>
981
+ <div class="refsect2" title="g_thread_foreach ()">
982
+ <a name="g-thread-foreach"></a><h3>g_thread_foreach ()</h3>
983
+ <pre class="programlisting"><span class="returnvalue">void</span> g_thread_foreach (<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GFunc" title="GFunc ()"><span class="type">GFunc</span></a> thread_func</code></em>,
984
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
985
+ <p>
986
+ Call <em class="parameter"><code>thread_func</code></em> on all existing <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> structures. Note that
987
+ threads may decide to exit while <em class="parameter"><code>thread_func</code></em> is running, so
988
+ without intimate knowledge about the lifetime of foreign threads,
989
+ <em class="parameter"><code>thread_func</code></em> shouldn't access the GThread* pointer passed in as
990
+ first argument. However, <em class="parameter"><code>thread_func</code></em> will not be called for threads
991
+ which are known to have exited already.
992
+ </p>
993
+ <p>
994
+ Due to thread lifetime checks, this function has an execution complexity
995
+ which is quadratic in the number of existing threads.
996
+ </p>
997
+ <div class="variablelist"><table border="0">
998
+ <col align="left" valign="top">
999
+ <tbody>
1000
+ <tr>
1001
+ <td><p><span class="term"><em class="parameter"><code>thread_func</code></em> :</span></p></td>
1002
+ <td>function to call for all GThread structures
1003
+ </td>
1004
+ </tr>
1005
+ <tr>
1006
+ <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
1007
+ <td>second argument to <em class="parameter"><code>thread_func</code></em>
1008
+ </td>
1009
+ </tr>
1010
+ </tbody>
1011
+ </table></div>
1012
+ <p class="since">Since 2.10</p>
1013
+ </div>
1014
+ <hr>
1015
+ <div class="refsect2" title="GMutex">
1016
+ <a name="GMutex"></a><h3>GMutex</h3>
1017
+ <pre class="programlisting">typedef struct _GMutex GMutex;</pre>
1018
+ <p>
1019
+ The <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> struct is an opaque data structure to represent a mutex
1020
+ (mutual exclusion). It can be used to protect data against shared
1021
+ access. Take for example the following function:
1022
+ </p>
1023
+ <p>
1024
+ </p>
1025
+ <div class="example">
1026
+ <a name="id605647"></a><p class="title"><b>Example 2. A function which will not work in a threaded environment</b></p>
1027
+ <div class="example-contents">
1028
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1029
+ <tbody>
1030
+ <tr>
1031
+ <td class="listing_lines" align="right"><pre>1
1032
+ 2
1033
+ 3
1034
+ 4
1035
+ 5
1036
+ 6
1037
+ 7
1038
+ 8
1039
+ 9
1040
+ 10
1041
+ 11
1042
+ 12</pre></td>
1043
+ <td class="listing_code"><pre class="programlisting"><span class="type">int</span>
1044
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1045
+ <span class="cbracket">{</span>
1046
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">int</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
1047
+
1048
+ <span class="normal"> </span><span class="comment">/* now do a very complicated calculation to calculate the new</span>
1049
+ <span class="comment"> * number, this might for example be a random number generator</span>
1050
+ <span class="comment"> */</span>
1051
+ <span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1052
+
1053
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> current_number</span><span class="symbol">;</span>
1054
+ <span class="cbracket">}</span></pre></td>
1055
+ </tr>
1056
+ </tbody>
1057
+ </table>
1058
+ </div>
1059
+
1060
+ </div>
1061
+ <p><br class="example-break">
1062
+ </p>
1063
+ <p>
1064
+ It is easy to see that this won't work in a multi-threaded
1065
+ application. There current_number must be protected against shared
1066
+ access. A first naive implementation would be:
1067
+ </p>
1068
+ <p>
1069
+ </p>
1070
+ <div class="example">
1071
+ <a name="id605678"></a><p class="title"><b>Example 3. The wrong way to write a thread-safe function</b></p>
1072
+ <div class="example-contents">
1073
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1074
+ <tbody>
1075
+ <tr>
1076
+ <td class="listing_lines" align="right"><pre>1
1077
+ 2
1078
+ 3
1079
+ 4
1080
+ 5
1081
+ 6
1082
+ 7
1083
+ 8
1084
+ 9
1085
+ 10
1086
+ 11
1087
+ 12
1088
+ 13
1089
+ 14
1090
+ 15</pre></td>
1091
+ <td class="listing_code"><pre class="programlisting"><span class="type">int</span>
1092
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1093
+ <span class="cbracket">{</span>
1094
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">int</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
1095
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1096
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> <a href="glib-Threads.html#GMutex">GMutex</a> </span><span class="symbol">*</span><span class="normal"> mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
1097
+
1098
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">mutex</span><span class="symbol">)</span><span class="normal"> mutex </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-new">g_mutex_new</a></span><span class="normal"> </span><span class="symbol">();</span>
1099
+
1100
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-lock">g_mutex_lock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">mutex</span><span class="symbol">);</span>
1101
+ <span class="normal"> ret_val </span><span class="symbol">=</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1102
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-unlock">g_mutex_unlock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">mutex</span><span class="symbol">);</span>
1103
+
1104
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1105
+ <span class="cbracket">}</span></pre></td>
1106
+ </tr>
1107
+ </tbody>
1108
+ </table>
1109
+ </div>
1110
+
1111
+ </div>
1112
+ <p><br class="example-break">
1113
+ </p>
1114
+ <p>
1115
+ This looks like it would work, but there is a race condition while
1116
+ constructing the mutex and this code cannot work reliable. Please do
1117
+ not use such constructs in your own programs! One working solution
1118
+ is:
1119
+ </p>
1120
+ <p>
1121
+ </p>
1122
+ <div class="example">
1123
+ <a name="id605707"></a><p class="title"><b>Example 4. A correct thread-safe function</b></p>
1124
+ <div class="example-contents">
1125
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1126
+ <tbody>
1127
+ <tr>
1128
+ <td class="listing_lines" align="right"><pre>1
1129
+ 2
1130
+ 3
1131
+ 4
1132
+ 5
1133
+ 6
1134
+ 7
1135
+ 8
1136
+ 9
1137
+ 10
1138
+ 11
1139
+ 12
1140
+ 13
1141
+ 14
1142
+ 15
1143
+ 16
1144
+ 17
1145
+ 18
1146
+ 19
1147
+ 20
1148
+ 21
1149
+ 22
1150
+ 23
1151
+ 24
1152
+ 25
1153
+ 26</pre></td>
1154
+ <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> </span><span class="usertype">GMutex</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">give_me_next_number_mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
1155
+
1156
+ <span class="comment">/* this function must be called before any call to</span>
1157
+ <span class="comment"> * give_me_next_number()</span>
1158
+ <span class="comment"> *</span>
1159
+ <span class="comment"> * it must be called exactly once.</span>
1160
+ <span class="comment"> */</span>
1161
+ <span class="type">void</span>
1162
+ <span class="function">init_give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1163
+ <span class="cbracket">{</span>
1164
+ <span class="normal"> </span><span class="function"><a href="glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">give_me_next_number_mutex </span><span class="symbol">==</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
1165
+ <span class="normal"> give_me_next_number_mutex </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-new">g_mutex_new</a></span><span class="normal"> </span><span class="symbol">();</span>
1166
+ <span class="cbracket">}</span>
1167
+
1168
+ <span class="type">int</span>
1169
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1170
+ <span class="cbracket">{</span>
1171
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">int</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
1172
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1173
+
1174
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-lock">g_mutex_lock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">give_me_next_number_mutex</span><span class="symbol">);</span>
1175
+ <span class="normal"> ret_val </span><span class="symbol">=</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1176
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-unlock">g_mutex_unlock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">give_me_next_number_mutex</span><span class="symbol">);</span>
1177
+
1178
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1179
+ <span class="cbracket">}</span></pre></td>
1180
+ </tr>
1181
+ </tbody>
1182
+ </table>
1183
+ </div>
1184
+
1185
+ </div>
1186
+ <p><br class="example-break">
1187
+ </p>
1188
+ <p>
1189
+ <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> provides a simpler and safer way of doing this.
1190
+ </p>
1191
+ <p>
1192
+ If you want to use a mutex, and your code should also work without
1193
+ calling <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> first, then you can not use a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, as
1194
+ <a class="link" href="glib-Threads.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a> requires that the thread system be initialized. Use a
1195
+ <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> instead.
1196
+ </p>
1197
+ <p>
1198
+ A <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> should only be accessed via the following functions.
1199
+ </p>
1200
+ <p>
1201
+ </p>
1202
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1203
+ <h3 class="title">Note</h3>
1204
+ <p>All of the <code class="function">g_mutex_*</code> functions are
1205
+ actually macros. Apart from taking their addresses, you can however
1206
+ use them as if they were functions.</p>
1207
+ </div>
1208
+ <p>
1209
+ </p>
1210
+ </div>
1211
+ <hr>
1212
+ <div class="refsect2" title="g_mutex_new ()">
1213
+ <a name="g-mutex-new"></a><h3>g_mutex_new ()</h3>
1214
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="returnvalue">GMutex</span></a> * g_mutex_new ();</pre>
1215
+ <p>
1216
+ Creates a new <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1217
+ </p>
1218
+ <p>
1219
+ </p>
1220
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1221
+ <h3 class="title">Note</h3>
1222
+ <p>This function will abort if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been
1223
+ called yet.</p>
1224
+ </div>
1225
+ <p>
1226
+ </p>
1227
+ <div class="variablelist"><table border="0">
1228
+ <col align="left" valign="top">
1229
+ <tbody><tr>
1230
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1231
+ <td>a new <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1232
+ </td>
1233
+ </tr></tbody>
1234
+ </table></div>
1235
+ </div>
1236
+ <hr>
1237
+ <div class="refsect2" title="g_mutex_lock ()">
1238
+ <a name="g-mutex-lock"></a><h3>g_mutex_lock ()</h3>
1239
+ <pre class="programlisting"><span class="returnvalue">void</span> g_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
1240
+ <p>
1241
+ Locks <em class="parameter"><code>mutex</code></em>. If <em class="parameter"><code>mutex</code></em> is already locked by another thread, the
1242
+ current thread will block until <em class="parameter"><code>mutex</code></em> is unlocked by the other
1243
+ thread.
1244
+ </p>
1245
+ <p>
1246
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
1247
+ called, and, in that case, will do nothing.
1248
+ </p>
1249
+ <p>
1250
+ </p>
1251
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1252
+ <h3 class="title">Note</h3>
1253
+ <p><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> is neither guaranteed to be recursive nor to be
1254
+ non-recursive, i.e. a thread could deadlock while calling
1255
+ <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>, if it already has locked <em class="parameter"><code>mutex</code></em>. Use
1256
+ <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>, if you need recursive mutexes.</p>
1257
+ </div>
1258
+ <p>
1259
+ </p>
1260
+ <div class="variablelist"><table border="0">
1261
+ <col align="left" valign="top">
1262
+ <tbody><tr>
1263
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1264
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1265
+ </td>
1266
+ </tr></tbody>
1267
+ </table></div>
1268
+ </div>
1269
+ <hr>
1270
+ <div class="refsect2" title="g_mutex_trylock ()">
1271
+ <a name="g-mutex-trylock"></a><h3>g_mutex_trylock ()</h3>
1272
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
1273
+ <p>
1274
+ Tries to lock <em class="parameter"><code>mutex</code></em>. If <em class="parameter"><code>mutex</code></em> is already locked by another thread,
1275
+ it immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>mutex</code></em> and returns
1276
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1277
+ </p>
1278
+ <p>
1279
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
1280
+ called, and, in that case, will immediately return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1281
+ </p>
1282
+ <p>
1283
+ </p>
1284
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1285
+ <h3 class="title">Note</h3>
1286
+ <p><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> is neither guaranteed to be recursive nor to be
1287
+ non-recursive, i.e. the return value of <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a> could be
1288
+ both <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> or <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the current thread already has locked
1289
+ <em class="parameter"><code>mutex</code></em>. Use <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>, if you need recursive
1290
+ mutexes.</p>
1291
+ </div>
1292
+ <p>
1293
+ </p>
1294
+ <div class="variablelist"><table border="0">
1295
+ <col align="left" valign="top">
1296
+ <tbody>
1297
+ <tr>
1298
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1299
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1300
+ </td>
1301
+ </tr>
1302
+ <tr>
1303
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1304
+ <td>
1305
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>mutex</code></em> could be locked.
1306
+ </td>
1307
+ </tr>
1308
+ </tbody>
1309
+ </table></div>
1310
+ </div>
1311
+ <hr>
1312
+ <div class="refsect2" title="g_mutex_unlock ()">
1313
+ <a name="g-mutex-unlock"></a><h3>g_mutex_unlock ()</h3>
1314
+ <pre class="programlisting"><span class="returnvalue">void</span> g_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
1315
+ <p>
1316
+ Unlocks <em class="parameter"><code>mutex</code></em>. If another thread is blocked in a <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>
1317
+ call for <em class="parameter"><code>mutex</code></em>, it will be woken and can lock <em class="parameter"><code>mutex</code></em> itself.
1318
+ </p>
1319
+ <p>
1320
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
1321
+ called, and, in that case, will do nothing.
1322
+ </p>
1323
+ <div class="variablelist"><table border="0">
1324
+ <col align="left" valign="top">
1325
+ <tbody><tr>
1326
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1327
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1328
+ </td>
1329
+ </tr></tbody>
1330
+ </table></div>
1331
+ </div>
1332
+ <hr>
1333
+ <div class="refsect2" title="g_mutex_free ()">
1334
+ <a name="g-mutex-free"></a><h3>g_mutex_free ()</h3>
1335
+ <pre class="programlisting"><span class="returnvalue">void</span> g_mutex_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
1336
+ <p>
1337
+ Destroys <em class="parameter"><code>mutex</code></em>.
1338
+ </p>
1339
+ <p>
1340
+ </p>
1341
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1342
+ <h3 class="title">Note</h3>
1343
+ <p>Calling <a class="link" href="glib-Threads.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a> on a locked mutex may result in
1344
+ undefined behaviour.</p>
1345
+ </div>
1346
+ <p>
1347
+ </p>
1348
+ <div class="variablelist"><table border="0">
1349
+ <col align="left" valign="top">
1350
+ <tbody><tr>
1351
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1352
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>.
1353
+ </td>
1354
+ </tr></tbody>
1355
+ </table></div>
1356
+ </div>
1357
+ <hr>
1358
+ <div class="refsect2" title="GStaticMutex">
1359
+ <a name="GStaticMutex"></a><h3>GStaticMutex</h3>
1360
+ <pre class="programlisting">typedef struct _GStaticMutex GStaticMutex;</pre>
1361
+ <p>
1362
+ A <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> works like a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, but it has one significant
1363
+ advantage. It doesn't need to be created at run-time like a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>,
1364
+ but can be defined at compile-time. Here is a shorter, easier and
1365
+ safer version of our <code class="function"><code class="function">give_me_next_number()</code></code>
1366
+ example:
1367
+ </p>
1368
+ <p>
1369
+ </p>
1370
+ <div class="example">
1371
+ <a name="id606617"></a><p class="title"><b>Example 5. 
1372
+ Using <span class="structname">GStaticMutex</span>
1373
+ to simplify thread-safe programming
1374
+ </b></p>
1375
+ <div class="example-contents">
1376
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1377
+ <tbody>
1378
+ <tr>
1379
+ <td class="listing_lines" align="right"><pre>1
1380
+ 2
1381
+ 3
1382
+ 4
1383
+ 5
1384
+ 6
1385
+ 7
1386
+ 8
1387
+ 9
1388
+ 10
1389
+ 11
1390
+ 12
1391
+ 13</pre></td>
1392
+ <td class="listing_code"><pre class="programlisting"><span class="type">int</span>
1393
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1394
+ <span class="cbracket">{</span>
1395
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">int</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
1396
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1397
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="usertype">GStaticMutex</span><span class="normal"> mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-MUTEX-INIT:CAPS">G_STATIC_MUTEX_INIT</a></span><span class="symbol">;</span>
1398
+
1399
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-mutex-lock">g_static_mutex_lock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">mutex</span><span class="symbol">);</span>
1400
+ <span class="normal"> ret_val </span><span class="symbol">=</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1401
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-mutex-unlock">g_static_mutex_unlock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">mutex</span><span class="symbol">);</span>
1402
+
1403
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1404
+ <span class="cbracket">}</span></pre></td>
1405
+ </tr>
1406
+ </tbody>
1407
+ </table>
1408
+ </div>
1409
+
1410
+ </div>
1411
+ <p><br class="example-break">
1412
+ </p>
1413
+ <p>
1414
+ Sometimes you would like to dynamically create a mutex. If you don't
1415
+ want to require prior calling to <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, because your code
1416
+ should also be usable in non-threaded programs, you are not able to
1417
+ use <a class="link" href="glib-Threads.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a> and thus <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, as that requires a prior call to
1418
+ <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>. In theses cases you can also use a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1419
+ It must be initialized with <a class="link" href="glib-Threads.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a> before using it
1420
+ and freed with with <a class="link" href="glib-Threads.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> when not needed anymore to
1421
+ free up any allocated resources.
1422
+ </p>
1423
+ <p>
1424
+ Even though <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> is not opaque, it should only be used with
1425
+ the following functions, as it is defined differently on different
1426
+ platforms.
1427
+ </p>
1428
+ <p>
1429
+ All of the <code class="function">g_static_mutex_*</code> functions apart
1430
+ from <code class="function">g_static_mutex_get_mutex</code> can also be used
1431
+ even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called. Then they do
1432
+ nothing, apart from <code class="function">g_static_mutex_trylock</code>,
1433
+ which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1434
+ </p>
1435
+ <p>
1436
+ </p>
1437
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1438
+ <h3 class="title">Note</h3>
1439
+ <p>All of the <code class="function">g_static_mutex_*</code>
1440
+ functions are actually macros. Apart from taking their addresses, you
1441
+ can however use them as if they were functions.</p>
1442
+ </div>
1443
+ <p>
1444
+ </p>
1445
+ </div>
1446
+ <hr>
1447
+ <div class="refsect2" title="G_STATIC_MUTEX_INIT">
1448
+ <a name="G-STATIC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_MUTEX_INIT</h3>
1449
+ <pre class="programlisting">#define G_STATIC_MUTEX_INIT
1450
+ </pre>
1451
+ <p>
1452
+ A <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> must be initialized with this macro, before it can
1453
+ be used. This macro can used be to initialize a variable, but it
1454
+ cannot be assigned to a variable. In that case you have to use
1455
+ <a class="link" href="glib-Threads.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a>.
1456
+ </p>
1457
+ <p>
1458
+ </p>
1459
+ <div class="informalexample">
1460
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1461
+ <tbody>
1462
+ <tr>
1463
+ <td class="listing_lines" align="right"><pre>1</pre></td>
1464
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GStaticMutex</span><span class="normal"> my_mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-MUTEX-INIT:CAPS">G_STATIC_MUTEX_INIT</a></span><span class="symbol">;</span></pre></td>
1465
+ </tr>
1466
+ </tbody>
1467
+ </table>
1468
+ </div>
1469
+
1470
+ <p>
1471
+ </p>
1472
+ </div>
1473
+ <hr>
1474
+ <div class="refsect2" title="g_static_mutex_init ()">
1475
+ <a name="g-static-mutex-init"></a><h3>g_static_mutex_init ()</h3>
1476
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_mutex_init (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1477
+ <p>
1478
+ Initializes <em class="parameter"><code>mutex</code></em>. Alternatively you can initialize it with
1479
+ <a class="link" href="glib-Threads.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT"><span class="type">G_STATIC_MUTEX_INIT</span></a>.
1480
+ </p>
1481
+ <div class="variablelist"><table border="0">
1482
+ <col align="left" valign="top">
1483
+ <tbody><tr>
1484
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1485
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be initialized.
1486
+ </td>
1487
+ </tr></tbody>
1488
+ </table></div>
1489
+ </div>
1490
+ <hr>
1491
+ <div class="refsect2" title="g_static_mutex_lock ()">
1492
+ <a name="g-static-mutex-lock"></a><h3>g_static_mutex_lock ()</h3>
1493
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1494
+ <p>
1495
+ Works like <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>, but for a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1496
+ </p>
1497
+ <div class="variablelist"><table border="0">
1498
+ <col align="left" valign="top">
1499
+ <tbody><tr>
1500
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1501
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1502
+ </td>
1503
+ </tr></tbody>
1504
+ </table></div>
1505
+ </div>
1506
+ <hr>
1507
+ <div class="refsect2" title="g_static_mutex_trylock ()">
1508
+ <a name="g-static-mutex-trylock"></a><h3>g_static_mutex_trylock ()</h3>
1509
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_static_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1510
+ <p>
1511
+ Works like <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a>, but for a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1512
+ </p>
1513
+ <div class="variablelist"><table border="0">
1514
+ <col align="left" valign="top">
1515
+ <tbody>
1516
+ <tr>
1517
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1518
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1519
+ </td>
1520
+ </tr>
1521
+ <tr>
1522
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1523
+ <td>
1524
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> could be locked.
1525
+ </td>
1526
+ </tr>
1527
+ </tbody>
1528
+ </table></div>
1529
+ </div>
1530
+ <hr>
1531
+ <div class="refsect2" title="g_static_mutex_unlock ()">
1532
+ <a name="g-static-mutex-unlock"></a><h3>g_static_mutex_unlock ()</h3>
1533
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1534
+ <p>
1535
+ Works like <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a>, but for a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1536
+ </p>
1537
+ <div class="variablelist"><table border="0">
1538
+ <col align="left" valign="top">
1539
+ <tbody><tr>
1540
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1541
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1542
+ </td>
1543
+ </tr></tbody>
1544
+ </table></div>
1545
+ </div>
1546
+ <hr>
1547
+ <div class="refsect2" title="g_static_mutex_get_mutex ()">
1548
+ <a name="g-static-mutex-get-mutex"></a><h3>g_static_mutex_get_mutex ()</h3>
1549
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="returnvalue">GMutex</span></a> * g_static_mutex_get_mutex (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1550
+ <p>
1551
+ For some operations (like <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a>) you must have a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>
1552
+ instead of a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. This function will return the
1553
+ corresponding <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> for <em class="parameter"><code>mutex</code></em>.
1554
+ </p>
1555
+ <div class="variablelist"><table border="0">
1556
+ <col align="left" valign="top">
1557
+ <tbody>
1558
+ <tr>
1559
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1560
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1561
+ </td>
1562
+ </tr>
1563
+ <tr>
1564
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1565
+ <td>the <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> corresponding to <em class="parameter"><code>mutex</code></em>.
1566
+ </td>
1567
+ </tr>
1568
+ </tbody>
1569
+ </table></div>
1570
+ </div>
1571
+ <hr>
1572
+ <div class="refsect2" title="g_static_mutex_free ()">
1573
+ <a name="g-static-mutex-free"></a><h3>g_static_mutex_free ()</h3>
1574
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_mutex_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
1575
+ <p>
1576
+ Releases all resources allocated to <em class="parameter"><code>mutex</code></em>.
1577
+ </p>
1578
+ <p>
1579
+ You don't have to call this functions for a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> with an
1580
+ unbounded lifetime, i.e. objects declared 'static', but if you have
1581
+ a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> as a member of a structure and the structure is
1582
+ freed, you should also free the <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1583
+ </p>
1584
+ <p>
1585
+ </p>
1586
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
1587
+ <h3 class="title">Note</h3>
1588
+ <p>Calling <a class="link" href="glib-Threads.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> on a locked mutex may
1589
+ result in undefined behaviour.</p>
1590
+ </div>
1591
+ <p>
1592
+ </p>
1593
+ <div class="variablelist"><table border="0">
1594
+ <col align="left" valign="top">
1595
+ <tbody><tr>
1596
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1597
+ <td>a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be freed.
1598
+ </td>
1599
+ </tr></tbody>
1600
+ </table></div>
1601
+ </div>
1602
+ <hr>
1603
+ <div class="refsect2" title="G_LOCK_DEFINE()">
1604
+ <a name="G-LOCK-DEFINE:CAPS"></a><h3>G_LOCK_DEFINE()</h3>
1605
+ <pre class="programlisting">#define G_LOCK_DEFINE(name)</pre>
1606
+ <p>
1607
+ The <code class="literal">G_LOCK_</code>* macros provide a convenient interface to <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>
1608
+ with the advantage that they will expand to nothing in programs
1609
+ compiled against a thread-disabled GLib, saving code and memory
1610
+ there. <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a> defines a lock. It can appear anywhere
1611
+ variable definitions may appear in programs, i.e. in the first block
1612
+ of a function or outside of functions. The <em class="parameter"><code>name</code></em> parameter will be
1613
+ mangled to get the name of the <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. This means that you
1614
+ can use names of existing variables as the parameter - e.g. the name
1615
+ of the variable you intent to protect with the lock. Look at our
1616
+ <code class="function"><code class="function">give_me_next_number()</code></code> example using the
1617
+ <code class="literal">G_LOCK_</code>* macros:
1618
+ </p>
1619
+ <p>
1620
+ </p>
1621
+ <div class="example">
1622
+ <a name="id607667"></a><p class="title"><b>Example 6. Using the <code class="literal">G_LOCK_</code>* convenience macros</b></p>
1623
+ <div class="example-contents">
1624
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1625
+ <tbody>
1626
+ <tr>
1627
+ <td class="listing_lines" align="right"><pre>1
1628
+ 2
1629
+ 3
1630
+ 4
1631
+ 5
1632
+ 6
1633
+ 7
1634
+ 8
1635
+ 9
1636
+ 10
1637
+ 11
1638
+ 12
1639
+ 13
1640
+ 14</pre></td>
1641
+ <td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-Threads.html#G-LOCK-DEFINE:CAPS">G_LOCK_DEFINE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1642
+
1643
+ <span class="type">int</span>
1644
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
1645
+ <span class="cbracket">{</span>
1646
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="type">int</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
1647
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1648
+
1649
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#G-LOCK:CAPS">G_LOCK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1650
+ <span class="normal"> ret_val </span><span class="symbol">=</span><span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1651
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#G-UNLOCK:CAPS">G_UNLOCK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number</span><span class="symbol">);</span>
1652
+
1653
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> ret_val</span><span class="symbol">;</span>
1654
+ <span class="cbracket">}</span></pre></td>
1655
+ </tr>
1656
+ </tbody>
1657
+ </table>
1658
+ </div>
1659
+
1660
+ </div>
1661
+ <p><br class="example-break">
1662
+ </p>
1663
+ <div class="variablelist"><table border="0">
1664
+ <col align="left" valign="top">
1665
+ <tbody><tr>
1666
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1667
+ <td>the name of the lock.
1668
+ </td>
1669
+ </tr></tbody>
1670
+ </table></div>
1671
+ </div>
1672
+ <hr>
1673
+ <div class="refsect2" title="G_LOCK_DEFINE_STATIC()">
1674
+ <a name="G-LOCK-DEFINE-STATIC:CAPS"></a><h3>G_LOCK_DEFINE_STATIC()</h3>
1675
+ <pre class="programlisting">#define G_LOCK_DEFINE_STATIC(name)</pre>
1676
+ <p>
1677
+ This works like <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a>, but it creates a static object.
1678
+ </p>
1679
+ <div class="variablelist"><table border="0">
1680
+ <col align="left" valign="top">
1681
+ <tbody><tr>
1682
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1683
+ <td>the name of the lock.
1684
+ </td>
1685
+ </tr></tbody>
1686
+ </table></div>
1687
+ </div>
1688
+ <hr>
1689
+ <div class="refsect2" title="G_LOCK_EXTERN()">
1690
+ <a name="G-LOCK-EXTERN:CAPS"></a><h3>G_LOCK_EXTERN()</h3>
1691
+ <pre class="programlisting">#define G_LOCK_EXTERN(name)</pre>
1692
+ <p>
1693
+ This declares a lock, that is defined with <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a> in another
1694
+ module.
1695
+ </p>
1696
+ <div class="variablelist"><table border="0">
1697
+ <col align="left" valign="top">
1698
+ <tbody><tr>
1699
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1700
+ <td>the name of the lock.
1701
+ </td>
1702
+ </tr></tbody>
1703
+ </table></div>
1704
+ </div>
1705
+ <hr>
1706
+ <div class="refsect2" title="G_LOCK()">
1707
+ <a name="G-LOCK:CAPS"></a><h3>G_LOCK()</h3>
1708
+ <pre class="programlisting">#define G_LOCK(name)</pre>
1709
+ <p>
1710
+ Works like <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>, but for a lock defined with
1711
+ <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a>.
1712
+ </p>
1713
+ <div class="variablelist"><table border="0">
1714
+ <col align="left" valign="top">
1715
+ <tbody><tr>
1716
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1717
+ <td>the name of the lock.
1718
+ </td>
1719
+ </tr></tbody>
1720
+ </table></div>
1721
+ </div>
1722
+ <hr>
1723
+ <div class="refsect2" title="G_TRYLOCK()">
1724
+ <a name="G-TRYLOCK:CAPS"></a><h3>G_TRYLOCK()</h3>
1725
+ <pre class="programlisting">#define G_TRYLOCK(name)</pre>
1726
+ <p>
1727
+ Works like <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a>, but for a lock defined with
1728
+ <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a>.
1729
+ </p>
1730
+ <div class="variablelist"><table border="0">
1731
+ <col align="left" valign="top">
1732
+ <tbody>
1733
+ <tr>
1734
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1735
+ <td>the name of the lock.
1736
+ </td>
1737
+ </tr>
1738
+ <tr>
1739
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1740
+ <td>
1741
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the lock could be locked.
1742
+ </td>
1743
+ </tr>
1744
+ </tbody>
1745
+ </table></div>
1746
+ </div>
1747
+ <hr>
1748
+ <div class="refsect2" title="G_UNLOCK()">
1749
+ <a name="G-UNLOCK:CAPS"></a><h3>G_UNLOCK()</h3>
1750
+ <pre class="programlisting">#define G_UNLOCK(name)</pre>
1751
+ <p>
1752
+ Works like <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a>, but for a lock defined with
1753
+ <a class="link" href="glib-Threads.html#G-LOCK-DEFINE:CAPS" title="G_LOCK_DEFINE()"><span class="type">G_LOCK_DEFINE</span></a>.
1754
+ </p>
1755
+ <div class="variablelist"><table border="0">
1756
+ <col align="left" valign="top">
1757
+ <tbody><tr>
1758
+ <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1759
+ <td>the name of the lock.
1760
+ </td>
1761
+ </tr></tbody>
1762
+ </table></div>
1763
+ </div>
1764
+ <hr>
1765
+ <div class="refsect2" title="GStaticRecMutex">
1766
+ <a name="GStaticRecMutex"></a><h3>GStaticRecMutex</h3>
1767
+ <pre class="programlisting">typedef struct {
1768
+ } GStaticRecMutex;
1769
+ </pre>
1770
+ <p>
1771
+ A <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> works like a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, but it can be locked
1772
+ multiple times by one thread. If you enter it n times, you have to
1773
+ unlock it n times again to let other threads lock it. An exception
1774
+ is the function <a class="link" href="glib-Threads.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a>: that allows you to
1775
+ unlock a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> completely returning the depth, (i.e. the
1776
+ number of times this mutex was locked). The depth can later be used
1777
+ to restore the state of the <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> by calling
1778
+ <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a>.
1779
+ </p>
1780
+ <p>
1781
+ Even though <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> is not opaque, it should only be used
1782
+ with the following functions.
1783
+ </p>
1784
+ <p>
1785
+ All of the <code class="function">g_static_rec_mutex_*</code> functions can
1786
+ be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do
1787
+ nothing, apart from <code class="function">g_static_rec_mutex_trylock</code>,
1788
+ which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1789
+ </p>
1790
+ </div>
1791
+ <hr>
1792
+ <div class="refsect2" title="G_STATIC_REC_MUTEX_INIT">
1793
+ <a name="G-STATIC-REC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_REC_MUTEX_INIT</h3>
1794
+ <pre class="programlisting">#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
1795
+ </pre>
1796
+ <p>
1797
+ A <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this macro before it can
1798
+ be used. This macro can used be to initialize a variable, but it
1799
+ cannot be assigned to a variable. In that case you have to use
1800
+ <a class="link" href="glib-Threads.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()"><code class="function">g_static_rec_mutex_init()</code></a>.
1801
+ </p>
1802
+ <p>
1803
+ </p>
1804
+ <div class="informalexample">
1805
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1806
+ <tbody>
1807
+ <tr>
1808
+ <td class="listing_lines" align="right"><pre>1</pre></td>
1809
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GStaticRecMutex</span><span class="normal"> my_mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-REC-MUTEX-INIT:CAPS">G_STATIC_REC_MUTEX_INIT</a></span><span class="symbol">;</span></pre></td>
1810
+ </tr>
1811
+ </tbody>
1812
+ </table>
1813
+ </div>
1814
+
1815
+ <p>
1816
+ </p>
1817
+ </div>
1818
+ <hr>
1819
+ <div class="refsect2" title="g_static_rec_mutex_init ()">
1820
+ <a name="g-static-rec-mutex-init"></a><h3>g_static_rec_mutex_init ()</h3>
1821
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rec_mutex_init (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1822
+ <p>
1823
+ A <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this function before it
1824
+ can be used. Alternatively you can initialize it with
1825
+ <a class="link" href="glib-Threads.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT"><span class="type">G_STATIC_REC_MUTEX_INIT</span></a>.
1826
+ </p>
1827
+ <div class="variablelist"><table border="0">
1828
+ <col align="left" valign="top">
1829
+ <tbody><tr>
1830
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1831
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be initialized.
1832
+ </td>
1833
+ </tr></tbody>
1834
+ </table></div>
1835
+ </div>
1836
+ <hr>
1837
+ <div class="refsect2" title="g_static_rec_mutex_lock ()">
1838
+ <a name="g-static-rec-mutex-lock"></a><h3>g_static_rec_mutex_lock ()</h3>
1839
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rec_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1840
+ <p>
1841
+ Locks <em class="parameter"><code>mutex</code></em>. If <em class="parameter"><code>mutex</code></em> is already locked by another thread, the
1842
+ current thread will block until <em class="parameter"><code>mutex</code></em> is unlocked by the other
1843
+ thread. If <em class="parameter"><code>mutex</code></em> is already locked by the calling thread, this
1844
+ functions increases the depth of <em class="parameter"><code>mutex</code></em> and returns immediately.
1845
+ </p>
1846
+ <div class="variablelist"><table border="0">
1847
+ <col align="left" valign="top">
1848
+ <tbody><tr>
1849
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1850
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.
1851
+ </td>
1852
+ </tr></tbody>
1853
+ </table></div>
1854
+ </div>
1855
+ <hr>
1856
+ <div class="refsect2" title="g_static_rec_mutex_trylock ()">
1857
+ <a name="g-static-rec-mutex-trylock"></a><h3>g_static_rec_mutex_trylock ()</h3>
1858
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_static_rec_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1859
+ <p>
1860
+ Tries to lock <em class="parameter"><code>mutex</code></em>. If <em class="parameter"><code>mutex</code></em> is already locked by another thread,
1861
+ it immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>mutex</code></em> and returns
1862
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If <em class="parameter"><code>mutex</code></em> is already locked by the calling thread, this
1863
+ functions increases the depth of <em class="parameter"><code>mutex</code></em> and immediately returns
1864
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1865
+ </p>
1866
+ <div class="variablelist"><table border="0">
1867
+ <col align="left" valign="top">
1868
+ <tbody>
1869
+ <tr>
1870
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1871
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.
1872
+ </td>
1873
+ </tr>
1874
+ <tr>
1875
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1876
+ <td>
1877
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>mutex</code></em> could be locked.
1878
+ </td>
1879
+ </tr>
1880
+ </tbody>
1881
+ </table></div>
1882
+ </div>
1883
+ <hr>
1884
+ <div class="refsect2" title="g_static_rec_mutex_unlock ()">
1885
+ <a name="g-static-rec-mutex-unlock"></a><h3>g_static_rec_mutex_unlock ()</h3>
1886
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rec_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1887
+ <p>
1888
+ Unlocks <em class="parameter"><code>mutex</code></em>. Another thread will be allowed to lock <em class="parameter"><code>mutex</code></em> only
1889
+ when it has been unlocked as many times as it had been locked
1890
+ before. If <em class="parameter"><code>mutex</code></em> is completely unlocked and another thread is
1891
+ blocked in a <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>, it will be
1892
+ woken and can lock <em class="parameter"><code>mutex</code></em> itself.
1893
+ </p>
1894
+ <div class="variablelist"><table border="0">
1895
+ <col align="left" valign="top">
1896
+ <tbody><tr>
1897
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1898
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to unlock.
1899
+ </td>
1900
+ </tr></tbody>
1901
+ </table></div>
1902
+ </div>
1903
+ <hr>
1904
+ <div class="refsect2" title="g_static_rec_mutex_lock_full ()">
1905
+ <a name="g-static-rec-mutex-lock-full"></a><h3>g_static_rec_mutex_lock_full ()</h3>
1906
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rec_mutex_lock_full (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>,
1907
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> depth</code></em>);</pre>
1908
+ <p>
1909
+ Works like calling <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> for <em class="parameter"><code>mutex</code></em> <em class="parameter"><code>depth</code></em> times.
1910
+ </p>
1911
+ <div class="variablelist"><table border="0">
1912
+ <col align="left" valign="top">
1913
+ <tbody>
1914
+ <tr>
1915
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1916
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.
1917
+ </td>
1918
+ </tr>
1919
+ <tr>
1920
+ <td><p><span class="term"><em class="parameter"><code>depth</code></em> :</span></p></td>
1921
+ <td>number of times this mutex has to be unlocked to be
1922
+ completely unlocked.
1923
+ </td>
1924
+ </tr>
1925
+ </tbody>
1926
+ </table></div>
1927
+ </div>
1928
+ <hr>
1929
+ <div class="refsect2" title="g_static_rec_mutex_unlock_full ()">
1930
+ <a name="g-static-rec-mutex-unlock-full"></a><h3>g_static_rec_mutex_unlock_full ()</h3>
1931
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> g_static_rec_mutex_unlock_full (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1932
+ <p>
1933
+ Completely unlocks <em class="parameter"><code>mutex</code></em>. If another thread is blocked in a
1934
+ <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>, it will be woken and can
1935
+ lock <em class="parameter"><code>mutex</code></em> itself. This function returns the number of times that
1936
+ <em class="parameter"><code>mutex</code></em> has been locked by the current thread. To restore the state
1937
+ before the call to <a class="link" href="glib-Threads.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a> you can call
1938
+ <a class="link" href="glib-Threads.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a> with the depth returned by this
1939
+ function.
1940
+ </p>
1941
+ <div class="variablelist"><table border="0">
1942
+ <col align="left" valign="top">
1943
+ <tbody>
1944
+ <tr>
1945
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1946
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to completely unlock.
1947
+ </td>
1948
+ </tr>
1949
+ <tr>
1950
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1951
+ <td>number of times <em class="parameter"><code>mutex</code></em> has been locked by the current
1952
+ thread.
1953
+ </td>
1954
+ </tr>
1955
+ </tbody>
1956
+ </table></div>
1957
+ </div>
1958
+ <hr>
1959
+ <div class="refsect2" title="g_static_rec_mutex_free ()">
1960
+ <a name="g-static-rec-mutex-free"></a><h3>g_static_rec_mutex_free ()</h3>
1961
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rec_mutex_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1962
+ <p>
1963
+ Releases all resources allocated to a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.
1964
+ </p>
1965
+ <p>
1966
+ You don't have to call this functions for a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> with an
1967
+ unbounded lifetime, i.e. objects declared 'static', but if you have
1968
+ a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> as a member of a structure and the structure is
1969
+ freed, you should also free the <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.
1970
+ </p>
1971
+ <div class="variablelist"><table border="0">
1972
+ <col align="left" valign="top">
1973
+ <tbody><tr>
1974
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
1975
+ <td>a <a class="link" href="glib-Threads.html#GStaticRecMutex" title="GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be freed.
1976
+ </td>
1977
+ </tr></tbody>
1978
+ </table></div>
1979
+ </div>
1980
+ <hr>
1981
+ <div class="refsect2" title="GStaticRWLock">
1982
+ <a name="GStaticRWLock"></a><h3>GStaticRWLock</h3>
1983
+ <pre class="programlisting">typedef struct {
1984
+ } GStaticRWLock;
1985
+ </pre>
1986
+ <p>
1987
+ The <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> struct represents a read-write lock. A read-write
1988
+ lock can be used for protecting data that some portions of code only
1989
+ read from, while others also write. In such situations it is
1990
+ desirable that several readers can read at once, whereas of course
1991
+ only one writer may write at a time. Take a look at the following
1992
+ example:
1993
+ </p>
1994
+ <p>
1995
+ </p>
1996
+ <div class="example">
1997
+ <a name="id609282"></a><p class="title"><b>Example 7. An array with access functions</b></p>
1998
+ <div class="example-contents">
1999
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2000
+ <tbody>
2001
+ <tr>
2002
+ <td class="listing_lines" align="right"><pre>1
2003
+ 2
2004
+ 3
2005
+ 4
2006
+ 5
2007
+ 6
2008
+ 7
2009
+ 8
2010
+ 9
2011
+ 10
2012
+ 11
2013
+ 12
2014
+ 13
2015
+ 14
2016
+ 15
2017
+ 16
2018
+ 17
2019
+ 18
2020
+ 19
2021
+ 20
2022
+ 21
2023
+ 22
2024
+ 23
2025
+ 24
2026
+ 25
2027
+ 26
2028
+ 27
2029
+ 28
2030
+ 29
2031
+ 30
2032
+ 31
2033
+ 32
2034
+ 33</pre></td>
2035
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GStaticRWLock</span><span class="normal"> rwlock </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-RW-LOCK-INIT:CAPS">G_STATIC_RW_LOCK_INIT</a></span><span class="symbol">;</span>
2036
+ <span class="usertype">GPtrArray</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">array</span><span class="symbol">;</span>
2037
+
2038
+ <span class="normal"><a href="glib-Basic-Types.html#gpointer">gpointer</a></span>
2039
+ <span class="function">my_array_get</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">guint</span><span class="normal"> index</span><span class="symbol">)</span>
2040
+ <span class="cbracket">{</span>
2041
+ <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> retval </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
2042
+
2043
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">array</span><span class="symbol">)</span>
2044
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
2045
+
2046
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-rw-lock-reader-lock">g_static_rw_lock_reader_lock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">rwlock</span><span class="symbol">);</span>
2047
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">index </span><span class="symbol">&lt;</span><span class="normal"> array</span><span class="symbol">-&gt;</span><span class="normal">len</span><span class="symbol">)</span>
2048
+ <span class="normal"> retval </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">array</span><span class="symbol">,</span><span class="normal"> index</span><span class="symbol">);</span>
2049
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-rw-lock-reader-unlock">g_static_rw_lock_reader_unlock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">rwlock</span><span class="symbol">);</span>
2050
+
2051
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> retval</span><span class="symbol">;</span>
2052
+ <span class="cbracket">}</span>
2053
+
2054
+ <span class="type">void</span>
2055
+ <span class="function">my_array_set</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">guint</span><span class="normal"> index</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">)</span>
2056
+ <span class="cbracket">{</span>
2057
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-rw-lock-writer-lock">g_static_rw_lock_writer_lock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">rwlock</span><span class="symbol">);</span>
2058
+
2059
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">array</span><span class="symbol">)</span>
2060
+ <span class="normal"> array </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-new">g_ptr_array_new</a></span><span class="normal"> </span><span class="symbol">();</span>
2061
+
2062
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">index </span><span class="symbol">&gt;=</span><span class="normal"> array</span><span class="symbol">-&gt;</span><span class="normal">len</span><span class="symbol">)</span>
2063
+ <span class="normal"> </span><span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-set-size">g_ptr_array_set_size</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">array</span><span class="symbol">,</span><span class="normal"> index</span><span class="symbol">+</span><span class="number">1</span><span class="symbol">);</span>
2064
+ <span class="normal"> </span><span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">array</span><span class="symbol">,</span><span class="normal"> index</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> data</span><span class="symbol">;</span>
2065
+
2066
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-rw-lock-writer-unlock">g_static_rw_lock_writer_unlock</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">rwlock</span><span class="symbol">);</span>
2067
+ <span class="cbracket">}</span></pre></td>
2068
+ </tr>
2069
+ </tbody>
2070
+ </table>
2071
+ </div>
2072
+
2073
+ </div>
2074
+ <p><br class="example-break">
2075
+ </p>
2076
+ <p>
2077
+ This example shows an array which can be accessed by many readers
2078
+ (the <code class="function"><code class="function">my_array_get()</code></code> function) simultaneously,
2079
+ whereas the writers (the <code class="function"><code class="function">my_array_set()</code></code>
2080
+ function) will only be allowed once at a time and only if no readers
2081
+ currently access the array. This is because of the potentially
2082
+ dangerous resizing of the array. Using these functions is fully
2083
+ multi-thread safe now.
2084
+ </p>
2085
+ <p>
2086
+ Most of the time, writers should have precedence over readers. That
2087
+ means, for this implementation, that as soon as a writer wants to
2088
+ lock the data, no other reader is allowed to lock the data, whereas,
2089
+ of course, the readers that already have locked the data are allowed
2090
+ to finish their operation. As soon as the last reader unlocks the
2091
+ data, the writer will lock it.
2092
+ </p>
2093
+ <p>
2094
+ Even though <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not opaque, it should only be used
2095
+ with the following functions.
2096
+ </p>
2097
+ <p>
2098
+ All of the <code class="function">g_static_rw_lock_*</code> functions can be
2099
+ used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do
2100
+ nothing, apart from <code class="function">g_static_rw_lock_*_trylock</code>,
2101
+ which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
2102
+ </p>
2103
+ <p>
2104
+ </p>
2105
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2106
+ <h3 class="title">Note</h3>
2107
+ <p>A read-write lock has a higher overhead than a mutex. For
2108
+ example, both <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()"><code class="function">g_static_rw_lock_reader_lock()</code></a> and
2109
+ <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a> have to lock and unlock a
2110
+ <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, so it takes at least twice the time to lock and unlock
2111
+ a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> that it does to lock and unlock a <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. So
2112
+ only data structures that are accessed by multiple readers, and which
2113
+ keep the lock for a considerable time justify a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a>. The
2114
+ above example most probably would fare better with a
2115
+ <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
2116
+ </div>
2117
+ <p>
2118
+ </p>
2119
+ </div>
2120
+ <hr>
2121
+ <div class="refsect2" title="G_STATIC_RW_LOCK_INIT">
2122
+ <a name="G-STATIC-RW-LOCK-INIT:CAPS"></a><h3>G_STATIC_RW_LOCK_INIT</h3>
2123
+ <pre class="programlisting">#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
2124
+ </pre>
2125
+ <p>
2126
+ A <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this macro before it can
2127
+ be used. This macro can used be to initialize a variable, but it
2128
+ cannot be assigned to a variable. In that case you have to use
2129
+ <a class="link" href="glib-Threads.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()"><code class="function">g_static_rw_lock_init()</code></a>.
2130
+ </p>
2131
+ <p>
2132
+ </p>
2133
+ <div class="informalexample">
2134
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2135
+ <tbody>
2136
+ <tr>
2137
+ <td class="listing_lines" align="right"><pre>1</pre></td>
2138
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GStaticRWLock</span><span class="normal"> my_lock </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-RW-LOCK-INIT:CAPS">G_STATIC_RW_LOCK_INIT</a></span><span class="symbol">;</span></pre></td>
2139
+ </tr>
2140
+ </tbody>
2141
+ </table>
2142
+ </div>
2143
+
2144
+ <p>
2145
+ </p>
2146
+ </div>
2147
+ <hr>
2148
+ <div class="refsect2" title="g_static_rw_lock_init ()">
2149
+ <a name="g-static-rw-lock-init"></a><h3>g_static_rw_lock_init ()</h3>
2150
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_init (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2151
+ <p>
2152
+ A <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this function before it
2153
+ can be used. Alternatively you can initialize it with
2154
+ <a class="link" href="glib-Threads.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT"><span class="type">G_STATIC_RW_LOCK_INIT</span></a>.
2155
+ </p>
2156
+ <div class="variablelist"><table border="0">
2157
+ <col align="left" valign="top">
2158
+ <tbody><tr>
2159
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2160
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be initialized.
2161
+ </td>
2162
+ </tr></tbody>
2163
+ </table></div>
2164
+ </div>
2165
+ <hr>
2166
+ <div class="refsect2" title="g_static_rw_lock_reader_lock ()">
2167
+ <a name="g-static-rw-lock-reader-lock"></a><h3>g_static_rw_lock_reader_lock ()</h3>
2168
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_reader_lock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2169
+ <p>
2170
+ Locks <em class="parameter"><code>lock</code></em> for reading. There may be unlimited concurrent locks for
2171
+ reading of a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> at the same time. If <em class="parameter"><code>lock</code></em> is already
2172
+ locked for writing by another thread or if another thread is already
2173
+ waiting to lock <em class="parameter"><code>lock</code></em> for writing, this function will block until
2174
+ <em class="parameter"><code>lock</code></em> is unlocked by the other writing thread and no other writing
2175
+ threads want to lock <em class="parameter"><code>lock</code></em>. This lock has to be unlocked by
2176
+ <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.
2177
+ </p>
2178
+ <p>
2179
+ <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not recursive. It might seem to be possible to
2180
+ recursively lock for reading, but that can result in a deadlock, due
2181
+ to writer preference.
2182
+ </p>
2183
+ <div class="variablelist"><table border="0">
2184
+ <col align="left" valign="top">
2185
+ <tbody><tr>
2186
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2187
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading.
2188
+ </td>
2189
+ </tr></tbody>
2190
+ </table></div>
2191
+ </div>
2192
+ <hr>
2193
+ <div class="refsect2" title="g_static_rw_lock_reader_trylock ()">
2194
+ <a name="g-static-rw-lock-reader-trylock"></a><h3>g_static_rw_lock_reader_trylock ()</h3>
2195
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_static_rw_lock_reader_trylock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2196
+ <p>
2197
+ Tries to lock <em class="parameter"><code>lock</code></em> for reading. If <em class="parameter"><code>lock</code></em> is already locked for
2198
+ writing by another thread or if another thread is already waiting to
2199
+ lock <em class="parameter"><code>lock</code></em> for writing, immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise locks
2200
+ <em class="parameter"><code>lock</code></em> for reading and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This lock has to be unlocked by
2201
+ <a class="link" href="glib-Threads.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.
2202
+ </p>
2203
+ <div class="variablelist"><table border="0">
2204
+ <col align="left" valign="top">
2205
+ <tbody>
2206
+ <tr>
2207
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2208
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading.
2209
+ </td>
2210
+ </tr>
2211
+ <tr>
2212
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2213
+ <td>
2214
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em> could be locked for reading.
2215
+ </td>
2216
+ </tr>
2217
+ </tbody>
2218
+ </table></div>
2219
+ </div>
2220
+ <hr>
2221
+ <div class="refsect2" title="g_static_rw_lock_reader_unlock ()">
2222
+ <a name="g-static-rw-lock-reader-unlock"></a><h3>g_static_rw_lock_reader_unlock ()</h3>
2223
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_reader_unlock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2224
+ <p>
2225
+ Unlocks <em class="parameter"><code>lock</code></em>. If a thread waits to lock <em class="parameter"><code>lock</code></em> for writing and all
2226
+ locks for reading have been unlocked, the waiting thread is woken up
2227
+ and can lock <em class="parameter"><code>lock</code></em> for writing.
2228
+ </p>
2229
+ <div class="variablelist"><table border="0">
2230
+ <col align="left" valign="top">
2231
+ <tbody><tr>
2232
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2233
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after reading.
2234
+ </td>
2235
+ </tr></tbody>
2236
+ </table></div>
2237
+ </div>
2238
+ <hr>
2239
+ <div class="refsect2" title="g_static_rw_lock_writer_lock ()">
2240
+ <a name="g-static-rw-lock-writer-lock"></a><h3>g_static_rw_lock_writer_lock ()</h3>
2241
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_writer_lock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2242
+ <p>
2243
+ Locks <em class="parameter"><code>lock</code></em> for writing. If <em class="parameter"><code>lock</code></em> is already locked for writing or
2244
+ reading by other threads, this function will block until <em class="parameter"><code>lock</code></em> is
2245
+ completely unlocked and then lock <em class="parameter"><code>lock</code></em> for writing. While this
2246
+ functions waits to lock <em class="parameter"><code>lock</code></em>, no other thread can lock <em class="parameter"><code>lock</code></em> for
2247
+ reading. When <em class="parameter"><code>lock</code></em> is locked for writing, no other thread can lock
2248
+ <em class="parameter"><code>lock</code></em> (neither for reading nor writing). This lock has to be
2249
+ unlocked by <a class="link" href="glib-Threads.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.
2250
+ </p>
2251
+ <div class="variablelist"><table border="0">
2252
+ <col align="left" valign="top">
2253
+ <tbody><tr>
2254
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2255
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing.
2256
+ </td>
2257
+ </tr></tbody>
2258
+ </table></div>
2259
+ </div>
2260
+ <hr>
2261
+ <div class="refsect2" title="g_static_rw_lock_writer_trylock ()">
2262
+ <a name="g-static-rw-lock-writer-trylock"></a><h3>g_static_rw_lock_writer_trylock ()</h3>
2263
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_static_rw_lock_writer_trylock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2264
+ <p>
2265
+ Tries to lock <em class="parameter"><code>lock</code></em> for writing. If <em class="parameter"><code>lock</code></em> is already locked (for
2266
+ either reading or writing) by another thread, it immediately returns
2267
+ <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>lock</code></em> for writing and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This
2268
+ lock has to be unlocked by <a class="link" href="glib-Threads.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.
2269
+ </p>
2270
+ <div class="variablelist"><table border="0">
2271
+ <col align="left" valign="top">
2272
+ <tbody>
2273
+ <tr>
2274
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2275
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing.
2276
+ </td>
2277
+ </tr>
2278
+ <tr>
2279
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2280
+ <td>
2281
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em> could be locked for writing.
2282
+ </td>
2283
+ </tr>
2284
+ </tbody>
2285
+ </table></div>
2286
+ </div>
2287
+ <hr>
2288
+ <div class="refsect2" title="g_static_rw_lock_writer_unlock ()">
2289
+ <a name="g-static-rw-lock-writer-unlock"></a><h3>g_static_rw_lock_writer_unlock ()</h3>
2290
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_writer_unlock (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2291
+ <p>
2292
+ Unlocks <em class="parameter"><code>lock</code></em>. If a thread is waiting to lock <em class="parameter"><code>lock</code></em> for writing and
2293
+ all locks for reading have been unlocked, the waiting thread is
2294
+ woken up and can lock <em class="parameter"><code>lock</code></em> for writing. If no thread is waiting to
2295
+ lock <em class="parameter"><code>lock</code></em> for writing, and some thread or threads are waiting to
2296
+ lock <em class="parameter"><code>lock</code></em> for reading, the waiting threads are woken up and can
2297
+ lock <em class="parameter"><code>lock</code></em> for reading.
2298
+ </p>
2299
+ <div class="variablelist"><table border="0">
2300
+ <col align="left" valign="top">
2301
+ <tbody><tr>
2302
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2303
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after writing.
2304
+ </td>
2305
+ </tr></tbody>
2306
+ </table></div>
2307
+ </div>
2308
+ <hr>
2309
+ <div class="refsect2" title="g_static_rw_lock_free ()">
2310
+ <a name="g-static-rw-lock-free"></a><h3>g_static_rw_lock_free ()</h3>
2311
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_rw_lock_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
2312
+ <p>
2313
+ Releases all resources allocated to <em class="parameter"><code>lock</code></em>.
2314
+ </p>
2315
+ <p>
2316
+ You don't have to call this functions for a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> with an
2317
+ unbounded lifetime, i.e. objects declared 'static', but if you have
2318
+ a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> as a member of a structure, and the structure is
2319
+ freed, you should also free the <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a>.
2320
+ </p>
2321
+ <div class="variablelist"><table border="0">
2322
+ <col align="left" valign="top">
2323
+ <tbody><tr>
2324
+ <td><p><span class="term"><em class="parameter"><code>lock</code></em> :</span></p></td>
2325
+ <td>a <a class="link" href="glib-Threads.html#GStaticRWLock" title="GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be freed.
2326
+ </td>
2327
+ </tr></tbody>
2328
+ </table></div>
2329
+ </div>
2330
+ <hr>
2331
+ <div class="refsect2" title="GCond">
2332
+ <a name="GCond"></a><h3>GCond</h3>
2333
+ <pre class="programlisting">typedef struct _GCond GCond;</pre>
2334
+ <p>
2335
+ The <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> struct is an opaque data structure that represents a
2336
+ condition. Threads can block on a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> if they find a certain
2337
+ condition to be false. If other threads change the state of this
2338
+ condition they signal the <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>, and that causes the waiting
2339
+ threads to be woken up.
2340
+ </p>
2341
+ <p>
2342
+ </p>
2343
+ <div class="example">
2344
+ <a name="id610685"></a><p class="title"><b>Example 8. 
2345
+ Using GCond to block a thread until a condition is satisfied
2346
+ </b></p>
2347
+ <div class="example-contents">
2348
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2349
+ <tbody>
2350
+ <tr>
2351
+ <td class="listing_lines" align="right"><pre>1
2352
+ 2
2353
+ 3
2354
+ 4
2355
+ 5
2356
+ 6
2357
+ 7
2358
+ 8
2359
+ 9
2360
+ 10
2361
+ 11
2362
+ 12
2363
+ 13
2364
+ 14
2365
+ 15
2366
+ 16
2367
+ 17
2368
+ 18
2369
+ 19
2370
+ 20
2371
+ 21
2372
+ 22
2373
+ 23
2374
+ 24
2375
+ 25
2376
+ 26
2377
+ 27</pre></td>
2378
+ <td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-Threads.html#GCond">GCond</a></span><span class="symbol">*</span><span class="normal"> data_cond </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* Must be initialized somewhere */</span>
2379
+ <span class="normal"><a href="glib-Threads.html#GMutex">GMutex</a></span><span class="symbol">*</span><span class="normal"> data_mutex </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* Must be initialized somewhere */</span>
2380
+ <span class="usertype">gpointer</span><span class="normal"> current_data </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
2381
+
2382
+ <span class="type">void</span>
2383
+ <span class="function">push_data</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">)</span>
2384
+ <span class="cbracket">{</span>
2385
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-lock">g_mutex_lock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_mutex</span><span class="symbol">);</span>
2386
+ <span class="normal"> current_data </span><span class="symbol">=</span><span class="normal"> data</span><span class="symbol">;</span>
2387
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-cond-signal">g_cond_signal</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_cond</span><span class="symbol">);</span>
2388
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-unlock">g_mutex_unlock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_mutex</span><span class="symbol">);</span>
2389
+ <span class="cbracket">}</span>
2390
+
2391
+ <span class="normal"><a href="glib-Basic-Types.html#gpointer">gpointer</a></span>
2392
+ <span class="function">pop_data</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
2393
+ <span class="cbracket">{</span>
2394
+ <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">;</span>
2395
+
2396
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-lock">g_mutex_lock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_mutex</span><span class="symbol">);</span>
2397
+ <span class="normal"> </span><span class="keyword">while</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">current_data</span><span class="symbol">)</span>
2398
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-cond-wait">g_cond_wait</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_cond</span><span class="symbol">,</span><span class="normal"> data_mutex</span><span class="symbol">);</span>
2399
+ <span class="normal"> data </span><span class="symbol">=</span><span class="normal"> current_data</span><span class="symbol">;</span>
2400
+ <span class="normal"> current_data </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
2401
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-mutex-unlock">g_mutex_unlock</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data_mutex</span><span class="symbol">);</span>
2402
+
2403
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> data</span><span class="symbol">;</span>
2404
+ <span class="cbracket">}</span></pre></td>
2405
+ </tr>
2406
+ </tbody>
2407
+ </table>
2408
+ </div>
2409
+
2410
+ </div>
2411
+ <p><br class="example-break">
2412
+ </p>
2413
+ <p>
2414
+ Whenever a thread calls <code class="function"><code class="function">pop_data()</code></code> now, it will
2415
+ wait until current_data is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, i.e. until some other thread
2416
+ has called <code class="function"><code class="function">push_data()</code></code>.
2417
+ </p>
2418
+ <p>
2419
+ </p>
2420
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2421
+ <h3 class="title">Note</h3>
2422
+ <p>It is important to use the <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a> and
2423
+ <a class="link" href="glib-Threads.html#g-cond-timed-wait" title="g_cond_timed_wait ()"><code class="function">g_cond_timed_wait()</code></a> functions only inside a loop which checks for the
2424
+ condition to be true. It is not guaranteed that the waiting thread
2425
+ will find the condition fulfilled after it wakes up, even if the
2426
+ signaling thread left the condition in that state: another thread may
2427
+ have altered the condition before the waiting thread got the chance
2428
+ to be woken up, even if the condition itself is protected by a
2429
+ <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, like above.</p>
2430
+ </div>
2431
+ <p>
2432
+ </p>
2433
+ <p>
2434
+ A <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> should only be accessed via the following functions.
2435
+ </p>
2436
+ <p>
2437
+ </p>
2438
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2439
+ <h3 class="title">Note</h3>
2440
+ <p>All of the <code class="function">g_cond_*</code> functions are
2441
+ actually macros. Apart from taking their addresses, you can however
2442
+ use them as if they were functions.</p>
2443
+ </div>
2444
+ <p>
2445
+ </p>
2446
+ </div>
2447
+ <hr>
2448
+ <div class="refsect2" title="g_cond_new ()">
2449
+ <a name="g-cond-new"></a><h3>g_cond_new ()</h3>
2450
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="returnvalue">GCond</span></a>* g_cond_new ();</pre>
2451
+ <p>
2452
+ Creates a new <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>. This function will abort, if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>
2453
+ has not been called yet.
2454
+ </p>
2455
+ <div class="variablelist"><table border="0">
2456
+ <col align="left" valign="top">
2457
+ <tbody><tr>
2458
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2459
+ <td>a new <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2460
+ </td>
2461
+ </tr></tbody>
2462
+ </table></div>
2463
+ </div>
2464
+ <hr>
2465
+ <div class="refsect2" title="g_cond_signal ()">
2466
+ <a name="g-cond-signal"></a><h3>g_cond_signal ()</h3>
2467
+ <pre class="programlisting"><span class="returnvalue">void</span> g_cond_signal (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);</pre>
2468
+ <p>
2469
+ If threads are waiting for <em class="parameter"><code>cond</code></em>, exactly one of them is woken up.
2470
+ It is good practice to hold the same lock as the waiting thread
2471
+ while calling this function, though not required.
2472
+ </p>
2473
+ <p>
2474
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2475
+ called, and, in that case, will do nothing.
2476
+ </p>
2477
+ <div class="variablelist"><table border="0">
2478
+ <col align="left" valign="top">
2479
+ <tbody><tr>
2480
+ <td><p><span class="term"><em class="parameter"><code>cond</code></em> :</span></p></td>
2481
+ <td>a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2482
+ </td>
2483
+ </tr></tbody>
2484
+ </table></div>
2485
+ </div>
2486
+ <hr>
2487
+ <div class="refsect2" title="g_cond_broadcast ()">
2488
+ <a name="g-cond-broadcast"></a><h3>g_cond_broadcast ()</h3>
2489
+ <pre class="programlisting"><span class="returnvalue">void</span> g_cond_broadcast (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);</pre>
2490
+ <p>
2491
+ If threads are waiting for <em class="parameter"><code>cond</code></em>, all of them are woken up. It is
2492
+ good practice to lock the same mutex as the waiting threads, while
2493
+ calling this function, though not required.
2494
+ </p>
2495
+ <p>
2496
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2497
+ called, and, in that case, will do nothing.
2498
+ </p>
2499
+ <div class="variablelist"><table border="0">
2500
+ <col align="left" valign="top">
2501
+ <tbody><tr>
2502
+ <td><p><span class="term"><em class="parameter"><code>cond</code></em> :</span></p></td>
2503
+ <td>a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2504
+ </td>
2505
+ </tr></tbody>
2506
+ </table></div>
2507
+ </div>
2508
+ <hr>
2509
+ <div class="refsect2" title="g_cond_wait ()">
2510
+ <a name="g-cond-wait"></a><h3>g_cond_wait ()</h3>
2511
+ <pre class="programlisting"><span class="returnvalue">void</span> g_cond_wait (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>,
2512
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
2513
+ <p>
2514
+ Waits until this thread is woken up on <em class="parameter"><code>cond</code></em>. The <em class="parameter"><code>mutex</code></em> is unlocked
2515
+ before falling asleep and locked again before resuming.
2516
+ </p>
2517
+ <p>
2518
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2519
+ called, and, in that case, will immediately return.
2520
+ </p>
2521
+ <div class="variablelist"><table border="0">
2522
+ <col align="left" valign="top">
2523
+ <tbody>
2524
+ <tr>
2525
+ <td><p><span class="term"><em class="parameter"><code>cond</code></em> :</span></p></td>
2526
+ <td>a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2527
+ </td>
2528
+ </tr>
2529
+ <tr>
2530
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
2531
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a>, that is currently locked.
2532
+ </td>
2533
+ </tr>
2534
+ </tbody>
2535
+ </table></div>
2536
+ </div>
2537
+ <hr>
2538
+ <div class="refsect2" title="g_cond_timed_wait ()">
2539
+ <a name="g-cond-timed-wait"></a><h3>g_cond_timed_wait ()</h3>
2540
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_cond_timed_wait (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>,
2541
+ <em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> *mutex</code></em>,
2542
+ <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal"><span class="type">GTimeVal</span></a> *abs_time</code></em>);</pre>
2543
+ <p>
2544
+ Waits until this thread is woken up on <em class="parameter"><code>cond</code></em>, but not longer than
2545
+ until the time specified by <em class="parameter"><code>abs_time</code></em>. The <em class="parameter"><code>mutex</code></em> is unlocked before
2546
+ falling asleep and locked again before resuming.
2547
+ </p>
2548
+ <p>
2549
+ If <em class="parameter"><code>abs_time</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, <a class="link" href="glib-Threads.html#g-cond-timed-wait" title="g_cond_timed_wait ()"><code class="function">g_cond_timed_wait()</code></a> acts like <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a>.
2550
+ </p>
2551
+ <p>
2552
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2553
+ called, and, in that case, will immediately return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
2554
+ </p>
2555
+ <p>
2556
+ To easily calculate <em class="parameter"><code>abs_time</code></em> a combination of <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time" title="g_get_current_time ()"><code class="function">g_get_current_time()</code></a>
2557
+ and <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add" title="g_time_val_add ()"><code class="function">g_time_val_add()</code></a> can be used.
2558
+ </p>
2559
+ <div class="variablelist"><table border="0">
2560
+ <col align="left" valign="top">
2561
+ <tbody>
2562
+ <tr>
2563
+ <td><p><span class="term"><em class="parameter"><code>cond</code></em> :</span></p></td>
2564
+ <td>a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2565
+ </td>
2566
+ </tr>
2567
+ <tr>
2568
+ <td><p><span class="term"><em class="parameter"><code>mutex</code></em> :</span></p></td>
2569
+ <td>a <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> that is currently locked.
2570
+ </td>
2571
+ </tr>
2572
+ <tr>
2573
+ <td><p><span class="term"><em class="parameter"><code>abs_time</code></em> :</span></p></td>
2574
+ <td>a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="GTimeVal"><span class="type">GTimeVal</span></a>, determining the final time.
2575
+ </td>
2576
+ </tr>
2577
+ <tr>
2578
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2579
+ <td>
2580
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>cond</code></em> was signalled, or <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> on timeout.
2581
+ </td>
2582
+ </tr>
2583
+ </tbody>
2584
+ </table></div>
2585
+ </div>
2586
+ <hr>
2587
+ <div class="refsect2" title="g_cond_free ()">
2588
+ <a name="g-cond-free"></a><h3>g_cond_free ()</h3>
2589
+ <pre class="programlisting"><span class="returnvalue">void</span> g_cond_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a> *cond</code></em>);</pre>
2590
+ <p>
2591
+ Destroys the <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2592
+ </p>
2593
+ <div class="variablelist"><table border="0">
2594
+ <col align="left" valign="top">
2595
+ <tbody><tr>
2596
+ <td><p><span class="term"><em class="parameter"><code>cond</code></em> :</span></p></td>
2597
+ <td>a <a class="link" href="glib-Threads.html#GCond" title="GCond"><span class="type">GCond</span></a>.
2598
+ </td>
2599
+ </tr></tbody>
2600
+ </table></div>
2601
+ </div>
2602
+ <hr>
2603
+ <div class="refsect2" title="GPrivate">
2604
+ <a name="GPrivate"></a><h3>GPrivate</h3>
2605
+ <pre class="programlisting">typedef struct _GPrivate GPrivate;</pre>
2606
+ <p>
2607
+ The <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> struct is an opaque data structure to represent a
2608
+ thread private data key. Threads can thereby obtain and set a
2609
+ pointer which is private to the current thread. Take our
2610
+ <code class="function">give_me_next_number()</code> example from
2611
+ above. Suppose we don't want <code class="literal">current_number</code> to be
2612
+ shared between the threads, but instead to be private to each thread.
2613
+ This can be done as follows:
2614
+ </p>
2615
+ <p>
2616
+ </p>
2617
+ <div class="example">
2618
+ <a name="id611735"></a><p class="title"><b>Example 9. Using GPrivate for per-thread data</b></p>
2619
+ <div class="example-contents">
2620
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2621
+ <tbody>
2622
+ <tr>
2623
+ <td class="listing_lines" align="right"><pre>1
2624
+ 2
2625
+ 3
2626
+ 4
2627
+ 5
2628
+ 6
2629
+ 7
2630
+ 8
2631
+ 9
2632
+ 10
2633
+ 11
2634
+ 12
2635
+ 13
2636
+ 14
2637
+ 15
2638
+ 16
2639
+ 17
2640
+ 18
2641
+ 19</pre></td>
2642
+ <td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-Threads.html#GPrivate">GPrivate</a></span><span class="symbol">*</span><span class="normal"> current_number_key </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* Must be initialized somewhere</span>
2643
+ <span class="comment"> with g_private_new (g_free); */</span>
2644
+
2645
+ <span class="type">int</span>
2646
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
2647
+ <span class="cbracket">{</span>
2648
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-private-get">g_private_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number_key</span><span class="symbol">);</span>
2649
+
2650
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">current_number</span><span class="symbol">)</span>
2651
+ <span class="normal"> </span><span class="cbracket">{</span>
2652
+ <span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Memory-Allocation.html#g-new">g_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1</span><span class="symbol">);</span>
2653
+ <span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
2654
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-private-set">g_private_set</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">current_number_key</span><span class="symbol">,</span><span class="normal"> current_number</span><span class="symbol">);</span>
2655
+ <span class="normal"> </span><span class="cbracket">}</span>
2656
+
2657
+ <span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(*</span><span class="normal">current_number</span><span class="symbol">);</span>
2658
+
2659
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number</span><span class="symbol">;</span>
2660
+ <span class="cbracket">}</span></pre></td>
2661
+ </tr>
2662
+ </tbody>
2663
+ </table>
2664
+ </div>
2665
+
2666
+ </div>
2667
+ <p><br class="example-break">
2668
+ </p>
2669
+ <p>
2670
+ Here the pointer belonging to the key
2671
+ <code class="literal">current_number_key</code> is read. If it is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it has
2672
+ not been set yet. Then get memory for an integer value, assign this
2673
+ memory to the pointer and write the pointer back. Now we have an
2674
+ integer value that is private to the current thread.
2675
+ </p>
2676
+ <p>
2677
+ The <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> struct should only be accessed via the following
2678
+ functions.
2679
+ </p>
2680
+ <p>
2681
+ </p>
2682
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2683
+ <h3 class="title">Note</h3>
2684
+ <p>All of the <code class="function">g_private_*</code> functions are
2685
+ actually macros. Apart from taking their addresses, you can however
2686
+ use them as if they were functions.</p>
2687
+ </div>
2688
+ <p>
2689
+ </p>
2690
+ </div>
2691
+ <hr>
2692
+ <div class="refsect2" title="g_private_new ()">
2693
+ <a name="g-private-new"></a><h3>g_private_new ()</h3>
2694
+ <pre class="programlisting"><a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="returnvalue">GPrivate</span></a>* g_private_new (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> destructor</code></em>);</pre>
2695
+ <p>
2696
+ Creates a new <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>. If <em class="parameter"><code>destructor</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it is a
2697
+ pointer to a destructor function. Whenever a thread ends and the
2698
+ corresponding pointer keyed to this instance of <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> is
2699
+ non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the destructor is called with this pointer as the
2700
+ argument.
2701
+ </p>
2702
+ <p>
2703
+ </p>
2704
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2705
+ <h3 class="title">Note</h3>
2706
+ <p><em class="parameter"><code>destructor</code></em> is used quite differently from <em class="parameter"><code>notify</code></em> in
2707
+ <a class="link" href="glib-Threads.html#g-static-private-set" title="g_static_private_set ()"><code class="function">g_static_private_set()</code></a>.</p>
2708
+ </div>
2709
+ <p>
2710
+ </p>
2711
+ <p>
2712
+ </p>
2713
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2714
+ <h3 class="title">Note</h3>
2715
+ <p>A <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> can not be freed. Reuse it instead, if you
2716
+ can, to avoid shortage, or use <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>.</p>
2717
+ </div>
2718
+ <p>
2719
+ </p>
2720
+ <p>
2721
+ </p>
2722
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2723
+ <h3 class="title">Note</h3>
2724
+ <p>This function will abort if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been
2725
+ called yet.</p>
2726
+ </div>
2727
+ <p>
2728
+ </p>
2729
+ <div class="variablelist"><table border="0">
2730
+ <col align="left" valign="top">
2731
+ <tbody>
2732
+ <tr>
2733
+ <td><p><span class="term"><em class="parameter"><code>destructor</code></em> :</span></p></td>
2734
+ <td>a function to destroy the data keyed to <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> when
2735
+ a thread ends.
2736
+ </td>
2737
+ </tr>
2738
+ <tr>
2739
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2740
+ <td>a new <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>.
2741
+ </td>
2742
+ </tr>
2743
+ </tbody>
2744
+ </table></div>
2745
+ </div>
2746
+ <hr>
2747
+ <div class="refsect2" title="g_private_get ()">
2748
+ <a name="g-private-get"></a><h3>g_private_get ()</h3>
2749
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> g_private_get (<em class="parameter"><code><a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> *private_key</code></em>);</pre>
2750
+ <p>
2751
+ Returns the pointer keyed to <em class="parameter"><code>private_key</code></em> for the current thread. If
2752
+ <a class="link" href="glib-Threads.html#g-private-set" title="g_private_set ()"><code class="function">g_private_set()</code></a> hasn't been called for the current <em class="parameter"><code>private_key</code></em> and
2753
+ thread yet, this pointer will be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
2754
+ </p>
2755
+ <p>
2756
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2757
+ called, and, in that case, will return the value of <em class="parameter"><code>private_key</code></em>
2758
+ casted to <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a>. Note however, that private data set
2759
+ <span class="emphasis"><em>before</em></span> <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> will
2760
+ <span class="emphasis"><em>not</em></span> be retained <span class="emphasis"><em>after</em></span> the
2761
+ call. Instead, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned in all threads directly after
2762
+ <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, regardless of any <a class="link" href="glib-Threads.html#g-private-set" title="g_private_set ()"><code class="function">g_private_set()</code></a> calls issued
2763
+ before threading system intialization.
2764
+ </p>
2765
+ <div class="variablelist"><table border="0">
2766
+ <col align="left" valign="top">
2767
+ <tbody>
2768
+ <tr>
2769
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
2770
+ <td>a <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>.
2771
+ </td>
2772
+ </tr>
2773
+ <tr>
2774
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2775
+ <td>the corresponding pointer.
2776
+ </td>
2777
+ </tr>
2778
+ </tbody>
2779
+ </table></div>
2780
+ </div>
2781
+ <hr>
2782
+ <div class="refsect2" title="g_private_set ()">
2783
+ <a name="g-private-set"></a><h3>g_private_set ()</h3>
2784
+ <pre class="programlisting"><span class="returnvalue">void</span> g_private_set (<em class="parameter"><code><a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a> *private_key</code></em>,
2785
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
2786
+ <p>
2787
+ Sets the pointer keyed to <em class="parameter"><code>private_key</code></em> for the current thread.
2788
+ </p>
2789
+ <p>
2790
+ This function can be used even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been
2791
+ called, and, in that case, will set <em class="parameter"><code>private_key</code></em> to <em class="parameter"><code>data</code></em> casted to
2792
+ <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>*. See <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()"><code class="function">g_private_get()</code></a> for resulting caveats.
2793
+ </p>
2794
+ <div class="variablelist"><table border="0">
2795
+ <col align="left" valign="top">
2796
+ <tbody>
2797
+ <tr>
2798
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
2799
+ <td>a <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>.
2800
+ </td>
2801
+ </tr>
2802
+ <tr>
2803
+ <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
2804
+ <td>the new pointer.
2805
+ </td>
2806
+ </tr>
2807
+ </tbody>
2808
+ </table></div>
2809
+ </div>
2810
+ <hr>
2811
+ <div class="refsect2" title="GStaticPrivate">
2812
+ <a name="GStaticPrivate"></a><h3>GStaticPrivate</h3>
2813
+ <pre class="programlisting">typedef struct {
2814
+ } GStaticPrivate;
2815
+ </pre>
2816
+ <p>
2817
+ A <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> works almost like a <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>, but it has one
2818
+ significant advantage. It doesn't need to be created at run-time
2819
+ like a <a class="link" href="glib-Threads.html#GPrivate" title="GPrivate"><span class="type">GPrivate</span></a>, but can be defined at compile-time. This is
2820
+ similar to the difference between <a class="link" href="glib-Threads.html#GMutex" title="GMutex"><span class="type">GMutex</span></a> and <a class="link" href="glib-Threads.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. Now
2821
+ look at our <code class="function"><code class="function">give_me_next_number()</code></code> example with
2822
+ <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>:
2823
+ </p>
2824
+ <p>
2825
+ </p>
2826
+ <div class="example">
2827
+ <a name="id612504"></a><p class="title"><b>Example 10. Using GStaticPrivate for per-thread data</b></p>
2828
+ <div class="example-contents">
2829
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2830
+ <tbody>
2831
+ <tr>
2832
+ <td class="listing_lines" align="right"><pre>1
2833
+ 2
2834
+ 3
2835
+ 4
2836
+ 5
2837
+ 6
2838
+ 7
2839
+ 8
2840
+ 9
2841
+ 10
2842
+ 11
2843
+ 12
2844
+ 13
2845
+ 14
2846
+ 15
2847
+ 16
2848
+ 17</pre></td>
2849
+ <td class="listing_code"><pre class="programlisting"><span class="type">int</span>
2850
+ <span class="function">give_me_next_number</span><span class="normal"> </span><span class="symbol">()</span>
2851
+ <span class="cbracket">{</span>
2852
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="usertype">GStaticPrivate</span><span class="normal"> current_number_key </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-PRIVATE-INIT:CAPS">G_STATIC_PRIVATE_INIT</a></span><span class="symbol">;</span>
2853
+ <span class="normal"> </span><span class="type">int</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-private-get">g_static_private_get</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">current_number_key</span><span class="symbol">);</span>
2854
+
2855
+ <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">current_number</span><span class="symbol">)</span>
2856
+ <span class="normal"> </span><span class="cbracket">{</span>
2857
+ <span class="normal"> current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Memory-Allocation.html#g-new">g_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="symbol">,</span><span class="number">1</span><span class="symbol">);</span>
2858
+ <span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
2859
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-static-private-set">g_static_private_set</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">current_number_key</span><span class="symbol">,</span><span class="normal"> current_number</span><span class="symbol">,</span><span class="normal"> <a href="glib-Memory-Allocation.html#g-free">g_free</a></span><span class="symbol">);</span>
2860
+ <span class="normal"> </span><span class="cbracket">}</span>
2861
+
2862
+ <span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number </span><span class="symbol">=</span><span class="normal"> </span><span class="function">calc_next_number</span><span class="normal"> </span><span class="symbol">(*</span><span class="normal">current_number</span><span class="symbol">);</span>
2863
+
2864
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">current_number</span><span class="symbol">;</span>
2865
+ <span class="cbracket">}</span></pre></td>
2866
+ </tr>
2867
+ </tbody>
2868
+ </table>
2869
+ </div>
2870
+
2871
+ </div>
2872
+ <p><br class="example-break">
2873
+ </p>
2874
+ </div>
2875
+ <hr>
2876
+ <div class="refsect2" title="G_STATIC_PRIVATE_INIT">
2877
+ <a name="G-STATIC-PRIVATE-INIT:CAPS"></a><h3>G_STATIC_PRIVATE_INIT</h3>
2878
+ <pre class="programlisting">#define G_STATIC_PRIVATE_INIT
2879
+ </pre>
2880
+ <p>
2881
+ Every <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> must be initialized with this macro, before it
2882
+ can be used.
2883
+ </p>
2884
+ <p>
2885
+ </p>
2886
+ <div class="informalexample">
2887
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2888
+ <tbody>
2889
+ <tr>
2890
+ <td class="listing_lines" align="right"><pre>1</pre></td>
2891
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GStaticPrivate</span><span class="normal"> my_private </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-STATIC-PRIVATE-INIT:CAPS">G_STATIC_PRIVATE_INIT</a></span><span class="symbol">;</span></pre></td>
2892
+ </tr>
2893
+ </tbody>
2894
+ </table>
2895
+ </div>
2896
+
2897
+ <p>
2898
+ </p>
2899
+ </div>
2900
+ <hr>
2901
+ <div class="refsect2" title="g_static_private_init ()">
2902
+ <a name="g-static-private-init"></a><h3>g_static_private_init ()</h3>
2903
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_private_init (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
2904
+ <p>
2905
+ Initializes <em class="parameter"><code>private_key</code></em>. Alternatively you can initialize it with
2906
+ <a class="link" href="glib-Threads.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT"><span class="type">G_STATIC_PRIVATE_INIT</span></a>.
2907
+ </p>
2908
+ <div class="variablelist"><table border="0">
2909
+ <col align="left" valign="top">
2910
+ <tbody><tr>
2911
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
2912
+ <td>a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be initialized.
2913
+ </td>
2914
+ </tr></tbody>
2915
+ </table></div>
2916
+ </div>
2917
+ <hr>
2918
+ <div class="refsect2" title="g_static_private_get ()">
2919
+ <a name="g-static-private-get"></a><h3>g_static_private_get ()</h3>
2920
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> g_static_private_get (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
2921
+ <p>
2922
+ Works like <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()"><code class="function">g_private_get()</code></a> only for a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>.
2923
+ </p>
2924
+ <p>
2925
+ This function works even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.
2926
+ </p>
2927
+ <div class="variablelist"><table border="0">
2928
+ <col align="left" valign="top">
2929
+ <tbody>
2930
+ <tr>
2931
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
2932
+ <td>a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>.
2933
+ </td>
2934
+ </tr>
2935
+ <tr>
2936
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2937
+ <td>the corresponding pointer.
2938
+ </td>
2939
+ </tr>
2940
+ </tbody>
2941
+ </table></div>
2942
+ </div>
2943
+ <hr>
2944
+ <div class="refsect2" title="g_static_private_set ()">
2945
+ <a name="g-static-private-set"></a><h3>g_static_private_set ()</h3>
2946
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_private_set (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>,
2947
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
2948
+ <em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
2949
+ <p>
2950
+ Sets the pointer keyed to <em class="parameter"><code>private_key</code></em> for the current thread and
2951
+ the function <em class="parameter"><code>notify</code></em> to be called with that pointer (<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> or
2952
+ non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>), whenever the pointer is set again or whenever the
2953
+ current thread ends.
2954
+ </p>
2955
+ <p>
2956
+ This function works even if <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.
2957
+ If <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> is called later, the <em class="parameter"><code>data</code></em> keyed to <em class="parameter"><code>private_key</code></em>
2958
+ will be inherited only by the main thread, i.e. the one that called
2959
+ <a class="link" href="glib-Threads.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.
2960
+ </p>
2961
+ <p>
2962
+ </p>
2963
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
2964
+ <h3 class="title">Note</h3>
2965
+ <p><em class="parameter"><code>notify</code></em> is used quite differently from <em class="parameter"><code>destructor</code></em> in
2966
+ <a class="link" href="glib-Threads.html#g-private-new" title="g_private_new ()"><code class="function">g_private_new()</code></a>.</p>
2967
+ </div>
2968
+ <p>
2969
+ </p>
2970
+ <div class="variablelist"><table border="0">
2971
+ <col align="left" valign="top">
2972
+ <tbody>
2973
+ <tr>
2974
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
2975
+ <td>a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>.
2976
+ </td>
2977
+ </tr>
2978
+ <tr>
2979
+ <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
2980
+ <td>the new pointer.
2981
+ </td>
2982
+ </tr>
2983
+ <tr>
2984
+ <td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
2985
+ <td>a function to be called with the pointer whenever the
2986
+ current thread ends or sets this pointer again.
2987
+ </td>
2988
+ </tr>
2989
+ </tbody>
2990
+ </table></div>
2991
+ </div>
2992
+ <hr>
2993
+ <div class="refsect2" title="g_static_private_free ()">
2994
+ <a name="g-static-private-free"></a><h3>g_static_private_free ()</h3>
2995
+ <pre class="programlisting"><span class="returnvalue">void</span> g_static_private_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
2996
+ <p>
2997
+ Releases all resources allocated to <em class="parameter"><code>private_key</code></em>.
2998
+ </p>
2999
+ <p>
3000
+ You don't have to call this functions for a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> with an
3001
+ unbounded lifetime, i.e. objects declared 'static', but if you have
3002
+ a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> as a member of a structure and the structure is
3003
+ freed, you should also free the <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a>.
3004
+ </p>
3005
+ <div class="variablelist"><table border="0">
3006
+ <col align="left" valign="top">
3007
+ <tbody><tr>
3008
+ <td><p><span class="term"><em class="parameter"><code>private_key</code></em> :</span></p></td>
3009
+ <td>a <a class="link" href="glib-Threads.html#GStaticPrivate" title="GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be freed.
3010
+ </td>
3011
+ </tr></tbody>
3012
+ </table></div>
3013
+ </div>
3014
+ <hr>
3015
+ <div class="refsect2" title="GOnce">
3016
+ <a name="GOnce"></a><h3>GOnce</h3>
3017
+ <pre class="programlisting">typedef struct {
3018
+ volatile GOnceStatus status;
3019
+ volatile gpointer retval;
3020
+ } GOnce;
3021
+ </pre>
3022
+ <p>
3023
+ A <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> struct controls a one-time initialization function. Any
3024
+ one-time initialization function must have its own unique <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a>
3025
+ struct.
3026
+ </p>
3027
+ <div class="variablelist"><table border="0">
3028
+ <col align="left" valign="top">
3029
+ <tbody>
3030
+ <tr>
3031
+ <td><p><span class="term">volatile <a class="link" href="glib-Threads.html#GOnceStatus" title="enum GOnceStatus"><span class="type">GOnceStatus</span></a> <em class="structfield"><code><a name="GOnce.status"></a>status</code></em>;</span></p></td>
3032
+ <td>the status of the <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a>
3033
+ </td>
3034
+ </tr>
3035
+ <tr>
3036
+ <td><p><span class="term">volatile <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> <em class="structfield"><code><a name="GOnce.retval"></a>retval</code></em>;</span></p></td>
3037
+ <td>the value returned by the call to the function, if <em class="parameter"><code>status</code></em>
3038
+ is <a class="link" href="glib-Threads.html#G-ONCE-STATUS-READY:CAPS"><code class="literal">G_ONCE_STATUS_READY</code></a>
3039
+ </td>
3040
+ </tr>
3041
+ </tbody>
3042
+ </table></div>
3043
+ <p class="since">Since 2.4</p>
3044
+ </div>
3045
+ <hr>
3046
+ <div class="refsect2" title="enum GOnceStatus">
3047
+ <a name="GOnceStatus"></a><h3>enum GOnceStatus</h3>
3048
+ <pre class="programlisting">typedef enum
3049
+ {
3050
+ G_ONCE_STATUS_NOTCALLED,
3051
+ G_ONCE_STATUS_PROGRESS,
3052
+ G_ONCE_STATUS_READY
3053
+ } GOnceStatus;
3054
+ </pre>
3055
+ <p>
3056
+ The possible statuses of a one-time initialization function
3057
+ controlled by a <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> struct.
3058
+ </p>
3059
+ <div class="variablelist"><table border="0">
3060
+ <col align="left" valign="top">
3061
+ <tbody>
3062
+ <tr>
3063
+ <td><p><a name="G-ONCE-STATUS-NOTCALLED:CAPS"></a><span class="term"><code class="literal">G_ONCE_STATUS_NOTCALLED</code></span></p></td>
3064
+ <td>the function has not been called yet.
3065
+ </td>
3066
+ </tr>
3067
+ <tr>
3068
+ <td><p><a name="G-ONCE-STATUS-PROGRESS:CAPS"></a><span class="term"><code class="literal">G_ONCE_STATUS_PROGRESS</code></span></p></td>
3069
+ <td>the function call is currently in progress.
3070
+ </td>
3071
+ </tr>
3072
+ <tr>
3073
+ <td><p><a name="G-ONCE-STATUS-READY:CAPS"></a><span class="term"><code class="literal">G_ONCE_STATUS_READY</code></span></p></td>
3074
+ <td>the function has been called.
3075
+ </td>
3076
+ </tr>
3077
+ </tbody>
3078
+ </table></div>
3079
+ <p class="since">Since 2.4</p>
3080
+ </div>
3081
+ <hr>
3082
+ <div class="refsect2" title="G_ONCE_INIT">
3083
+ <a name="G-ONCE-INIT:CAPS"></a><h3>G_ONCE_INIT</h3>
3084
+ <pre class="programlisting">#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL }
3085
+ </pre>
3086
+ <p>
3087
+ A <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> must be initialized with this macro before it can be used.
3088
+ </p>
3089
+ <p>
3090
+ </p>
3091
+ <div class="informalexample">
3092
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
3093
+ <tbody>
3094
+ <tr>
3095
+ <td class="listing_lines" align="right"><pre>1</pre></td>
3096
+ <td class="listing_code"><pre class="programlisting"><span class="usertype">GOnce</span><span class="normal"> my_once </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-ONCE-INIT:CAPS">G_ONCE_INIT</a></span><span class="symbol">;</span></pre></td>
3097
+ </tr>
3098
+ </tbody>
3099
+ </table>
3100
+ </div>
3101
+
3102
+ <p>
3103
+ </p>
3104
+ <p class="since">Since 2.4</p>
3105
+ </div>
3106
+ <hr>
3107
+ <div class="refsect2" title="g_once()">
3108
+ <a name="g-once"></a><h3>g_once()</h3>
3109
+ <pre class="programlisting">#define g_once(once, func, arg)</pre>
3110
+ <p>
3111
+ The first call to this routine by a process with a given <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a>
3112
+ struct calls <em class="parameter"><code>func</code></em> with the given argument. Thereafter, subsequent
3113
+ calls to <a class="link" href="glib-Threads.html#g-once" title="g_once()"><code class="function">g_once()</code></a> with the same <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> struct do not call <em class="parameter"><code>func</code></em>
3114
+ again, but return the stored result of the first call. On return
3115
+ from <a class="link" href="glib-Threads.html#g-once" title="g_once()"><code class="function">g_once()</code></a>, the status of <em class="parameter"><code>once</code></em> will be <a class="link" href="glib-Threads.html#G-ONCE-STATUS-READY:CAPS"><code class="literal">G_ONCE_STATUS_READY</code></a>.
3116
+ </p>
3117
+ <p>
3118
+ For example, a mutex or a thread-specific data key must be created
3119
+ exactly once. In a threaded environment, calling <a class="link" href="glib-Threads.html#g-once" title="g_once()"><code class="function">g_once()</code></a> ensures
3120
+ that the initialization is serialized across multiple threads.
3121
+ </p>
3122
+ <p>
3123
+ </p>
3124
+ <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
3125
+ <h3 class="title">Note</h3>
3126
+ <p>Calling <a class="link" href="glib-Threads.html#g-once" title="g_once()"><code class="function">g_once()</code></a> recursively on the same <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> struct in
3127
+ <em class="parameter"><code>func</code></em> will lead to a deadlock.</p>
3128
+ </div>
3129
+ <p>
3130
+ </p>
3131
+ <p>
3132
+ </p>
3133
+ <div class="informalexample">
3134
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
3135
+ <tbody>
3136
+ <tr>
3137
+ <td class="listing_lines" align="right"><pre>1
3138
+ 2
3139
+ 3
3140
+ 4
3141
+ 5
3142
+ 6
3143
+ 7
3144
+ 8
3145
+ 9</pre></td>
3146
+ <td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-Basic-Types.html#gpointer">gpointer</a></span>
3147
+ <span class="function">get_debug_flags</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
3148
+ <span class="cbracket">{</span>
3149
+ <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="usertype">GOnce</span><span class="normal"> my_once </span><span class="symbol">=</span><span class="normal"> <a href="glib-Threads.html#G-ONCE-INIT:CAPS">G_ONCE_INIT</a></span><span class="symbol">;</span>
3150
+
3151
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-once">g_once</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">my_once</span><span class="symbol">,</span><span class="normal"> parse_debug_flags</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
3152
+
3153
+ <span class="normal"> </span><span class="keyword">return</span><span class="normal"> my_once</span><span class="symbol">.</span><span class="normal">retval</span><span class="symbol">;</span>
3154
+ <span class="cbracket">}</span></pre></td>
3155
+ </tr>
3156
+ </tbody>
3157
+ </table>
3158
+ </div>
3159
+
3160
+ <p>
3161
+ </p>
3162
+ <div class="variablelist"><table border="0">
3163
+ <col align="left" valign="top">
3164
+ <tbody>
3165
+ <tr>
3166
+ <td><p><span class="term"><em class="parameter"><code>once</code></em> :</span></p></td>
3167
+ <td>a <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> structure
3168
+ </td>
3169
+ </tr>
3170
+ <tr>
3171
+ <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
3172
+ <td>the <a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> function associated to <em class="parameter"><code>once</code></em>. This function
3173
+ is called only once, regardless of the number of times it and
3174
+ its associated <a class="link" href="glib-Threads.html#GOnce" title="GOnce"><span class="type">GOnce</span></a> struct are passed to <a class="link" href="glib-Threads.html#g-once" title="g_once()"><code class="function">g_once()</code></a>.
3175
+ </td>
3176
+ </tr>
3177
+ <tr>
3178
+ <td><p><span class="term"><em class="parameter"><code>arg</code></em> :</span></p></td>
3179
+ <td>data to be passed to <em class="parameter"><code>func</code></em>
3180
+ </td>
3181
+ </tr>
3182
+ </tbody>
3183
+ </table></div>
3184
+ <p class="since">Since 2.4</p>
3185
+ </div>
3186
+ <hr>
3187
+ <div class="refsect2" title="g_once_init_enter ()">
3188
+ <a name="g-once-init-enter"></a><h3>g_once_init_enter ()</h3>
3189
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_once_init_enter (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *value_location</code></em>);</pre>
3190
+ <p>
3191
+ Function to be called when starting a critical initialization
3192
+ section. The argument <em class="parameter"><code>value_location</code></em> must point to a static
3193
+ 0-initialized variable that will be set to a value other than 0 at
3194
+ the end of the initialization section. In combination with
3195
+ <a class="link" href="glib-Threads.html#g-once-init-leave" title="g_once_init_leave ()"><code class="function">g_once_init_leave()</code></a> and the unique address <em class="parameter"><code>value_location</code></em>, it can
3196
+ be ensured that an initialization section will be executed only once
3197
+ during a program's life time, and that concurrent threads are
3198
+ blocked until initialization completed. To be used in constructs
3199
+ like this:
3200
+ </p>
3201
+ <p>
3202
+ </p>
3203
+ <div class="informalexample">
3204
+ <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
3205
+ <tbody>
3206
+ <tr>
3207
+ <td class="listing_lines" align="right"><pre>1
3208
+ 2
3209
+ 3
3210
+ 4
3211
+ 5
3212
+ 6
3213
+ 7
3214
+ 8
3215
+ 9
3216
+ 10</pre></td>
3217
+ <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> </span><span class="usertype">gsize</span><span class="normal"> initialization_value </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
3218
+
3219
+ <span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-Threads.html#g-once-init-enter">g_once_init_enter</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">initialization_value</span><span class="symbol">))</span>
3220
+ <span class="normal"> </span><span class="cbracket">{</span>
3221
+ <span class="normal"> </span><span class="usertype">gsize</span><span class="normal"> setup_value </span><span class="symbol">=</span><span class="normal"> </span><span class="number">42</span><span class="symbol">;</span><span class="normal"> </span><span class="comment">/* initialization code here */</span>
3222
+
3223
+ <span class="normal"> </span><span class="function"><a href="glib-Threads.html#g-once-init-leave">g_once_init_leave</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">initialization_value</span><span class="symbol">,</span><span class="normal"> setup_value</span><span class="symbol">);</span>
3224
+ <span class="normal"> </span><span class="cbracket">}</span>
3225
+
3226
+ <span class="comment">/* use initialization_value here */</span></pre></td>
3227
+ </tr>
3228
+ </tbody>
3229
+ </table>
3230
+ </div>
3231
+
3232
+ <p>
3233
+ </p>
3234
+ <div class="variablelist"><table border="0">
3235
+ <col align="left" valign="top">
3236
+ <tbody>
3237
+ <tr>
3238
+ <td><p><span class="term"><em class="parameter"><code>value_location</code></em> :</span></p></td>
3239
+ <td>location of a static initializable variable
3240
+ containing 0.
3241
+ </td>
3242
+ </tr>
3243
+ <tr>
3244
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3245
+ <td>
3246
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the initialization section should be entered,
3247
+ <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> and blocks otherwise
3248
+ </td>
3249
+ </tr>
3250
+ </tbody>
3251
+ </table></div>
3252
+ <p class="since">Since 2.14</p>
3253
+ </div>
3254
+ <hr>
3255
+ <div class="refsect2" title="g_once_init_leave ()">
3256
+ <a name="g-once-init-leave"></a><h3>g_once_init_leave ()</h3>
3257
+ <pre class="programlisting"><span class="returnvalue">void</span> g_once_init_leave (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *value_location</code></em>,
3258
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> initialization_value</code></em>);</pre>
3259
+ <p>
3260
+ Counterpart to <a class="link" href="glib-Threads.html#g-once-init-enter" title="g_once_init_enter ()"><code class="function">g_once_init_enter()</code></a>. Expects a location of a static
3261
+ 0-initialized initialization variable, and an initialization value
3262
+ other than 0. Sets the variable to the initialization value, and
3263
+ releases concurrent threads blocking in <a class="link" href="glib-Threads.html#g-once-init-enter" title="g_once_init_enter ()"><code class="function">g_once_init_enter()</code></a> on this
3264
+ initialization variable.
3265
+ </p>
3266
+ <div class="variablelist"><table border="0">
3267
+ <col align="left" valign="top">
3268
+ <tbody>
3269
+ <tr>
3270
+ <td><p><span class="term"><em class="parameter"><code>value_location</code></em> :</span></p></td>
3271
+ <td>location of a static initializable variable
3272
+ containing 0.
3273
+ </td>
3274
+ </tr>
3275
+ <tr>
3276
+ <td><p><span class="term"><em class="parameter"><code>initialization_value</code></em> :</span></p></td>
3277
+ <td>new non-0 value for *<em class="parameter"><code>value_location</code></em>.
3278
+ </td>
3279
+ </tr>
3280
+ </tbody>
3281
+ </table></div>
3282
+ <p class="since">Since 2.14</p>
3283
+ </div>
3284
+ <hr>
3285
+ <div class="refsect2" title="g_bit_lock ()">
3286
+ <a name="g-bit-lock"></a><h3>g_bit_lock ()</h3>
3287
+ <pre class="programlisting"><span class="returnvalue">void</span> g_bit_lock (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
3288
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);</pre>
3289
+ <p>
3290
+ Sets the indicated <em class="parameter"><code>lock_bit</code></em> in <em class="parameter"><code>address</code></em>. If the bit is already
3291
+ set, this call will block until <a class="link" href="glib-Threads.html#g-bit-unlock" title="g_bit_unlock ()"><code class="function">g_bit_unlock()</code></a> unsets the
3292
+ corresponding bit.
3293
+ </p>
3294
+ <p>
3295
+ Attempting to lock on two different bits within the same integer is
3296
+ not supported and will very probably cause deadlocks.
3297
+ </p>
3298
+ <p>
3299
+ The value of the bit that is set is (1u &lt;&lt; <em class="parameter"><code>bit</code></em>). If <em class="parameter"><code>bit</code></em> is not
3300
+ between 0 and 31 then the result is undefined.
3301
+ </p>
3302
+ <p>
3303
+ This function accesses <em class="parameter"><code>address</code></em> atomically. All other accesses to
3304
+ <em class="parameter"><code>address</code></em> must be atomic in order for this function to work
3305
+ reliably.
3306
+ </p>
3307
+ <div class="variablelist"><table border="0">
3308
+ <col align="left" valign="top">
3309
+ <tbody>
3310
+ <tr>
3311
+ <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
3312
+ <td>a pointer to an integer
3313
+ </td>
3314
+ </tr>
3315
+ <tr>
3316
+ <td><p><span class="term"><em class="parameter"><code>lock_bit</code></em> :</span></p></td>
3317
+ <td>a bit value between 0 and 31
3318
+ </td>
3319
+ </tr>
3320
+ </tbody>
3321
+ </table></div>
3322
+ <p class="since">Since 2.24</p>
3323
+ </div>
3324
+ <hr>
3325
+ <div class="refsect2" title="g_bit_trylock ()">
3326
+ <a name="g-bit-trylock"></a><h3>g_bit_trylock ()</h3>
3327
+ <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_bit_trylock (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
3328
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);</pre>
3329
+ <p>
3330
+ Sets the indicated <em class="parameter"><code>lock_bit</code></em> in <em class="parameter"><code>address</code></em>, returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if
3331
+ successful. If the bit is already set, returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> immediately.
3332
+ </p>
3333
+ <p>
3334
+ Attempting to lock on two different bits within the same integer is
3335
+ not supported.
3336
+ </p>
3337
+ <p>
3338
+ The value of the bit that is set is (1u &lt;&lt; <em class="parameter"><code>bit</code></em>). If <em class="parameter"><code>bit</code></em> is not
3339
+ between 0 and 31 then the result is undefined.
3340
+ </p>
3341
+ <p>
3342
+ This function accesses <em class="parameter"><code>address</code></em> atomically. All other accesses to
3343
+ <em class="parameter"><code>address</code></em> must be atomic in order for this function to work
3344
+ reliably.
3345
+ </p>
3346
+ <div class="variablelist"><table border="0">
3347
+ <col align="left" valign="top">
3348
+ <tbody>
3349
+ <tr>
3350
+ <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
3351
+ <td>a pointer to an integer
3352
+ </td>
3353
+ </tr>
3354
+ <tr>
3355
+ <td><p><span class="term"><em class="parameter"><code>lock_bit</code></em> :</span></p></td>
3356
+ <td>a bit value between 0 and 31
3357
+ </td>
3358
+ </tr>
3359
+ <tr>
3360
+ <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3361
+ <td>
3362
+ <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the lock was acquired
3363
+ </td>
3364
+ </tr>
3365
+ </tbody>
3366
+ </table></div>
3367
+ <p class="since">Since 2.24</p>
3368
+ </div>
3369
+ <hr>
3370
+ <div class="refsect2" title="g_bit_unlock ()">
3371
+ <a name="g-bit-unlock"></a><h3>g_bit_unlock ()</h3>
3372
+ <pre class="programlisting"><span class="returnvalue">void</span> g_bit_unlock (<em class="parameter"><code>volatile <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> *address</code></em>,
3373
+ <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> lock_bit</code></em>);</pre>
3374
+ <p>
3375
+ Clears the indicated <em class="parameter"><code>lock_bit</code></em> in <em class="parameter"><code>address</code></em>. If another thread is
3376
+ currently blocked in <a class="link" href="glib-Threads.html#g-bit-lock" title="g_bit_lock ()"><code class="function">g_bit_lock()</code></a> on this same bit then it will be
3377
+ woken up.
3378
+ </p>
3379
+ <p>
3380
+ This function accesses <em class="parameter"><code>address</code></em> atomically. All other accesses to
3381
+ <em class="parameter"><code>address</code></em> must be atomic in order for this function to work
3382
+ reliably.
3383
+ </p>
3384
+ <div class="variablelist"><table border="0">
3385
+ <col align="left" valign="top">
3386
+ <tbody>
3387
+ <tr>
3388
+ <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
3389
+ <td>a pointer to an integer
3390
+ </td>
3391
+ </tr>
3392
+ <tr>
3393
+ <td><p><span class="term"><em class="parameter"><code>lock_bit</code></em> :</span></p></td>
3394
+ <td>a bit value between 0 and 31
3395
+ </td>
3396
+ </tr>
3397
+ </tbody>
3398
+ </table></div>
3399
+ <p class="since">Since 2.24</p>
3400
+ </div>
3401
+ </div>
3402
+ <div class="refsect1" title="See Also">
3403
+ <a name="glib-Threads.see-also"></a><h2>See Also</h2>
3404
+ <a class="link" href="glib-Thread-Pools.html#GThreadPool" title="GThreadPool"><span class="type">GThreadPool</span></a>, <a class="link" href="glib-Asynchronous-Queues.html#GAsyncQueue" title="GAsyncQueue"><span class="type">GAsyncQueue</span></a>
3405
+ </div>
3406
+ </div>
3407
+ <div class="footer">
3408
+ <hr>
3409
+ Generated by GTK-Doc V1.14</div>
3410
+ </body>
3411
+ </html>