File: GdaThreadWrapper.html

package info (click to toggle)
libgda5 5.2.10-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,168 kB
  • sloc: ansic: 495,319; xml: 10,486; yacc: 5,165; sh: 4,451; makefile: 4,095; php: 1,416; java: 1,300; javascript: 1,298; python: 896; sql: 879; perl: 116
file content (1049 lines) | stat: -rw-r--r-- 68,435 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GdaThreadWrapper: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="multi-threading.html" title="Multi threading">
<link rel="prev" href="GdaLockable.html" title="GdaLockable">
<link rel="next" href="misc.html" title="Miscellaneous">
<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GdaThreadWrapper.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GdaThreadWrapper.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="multi-threading.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GdaLockable.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="misc.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GdaThreadWrapper"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GdaThreadWrapper.top_of_page"></a>GdaThreadWrapper</span></h2>
<p>GdaThreadWrapper — Execute functions in a sub thread</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GdaThreadWrapper.stability-level"></a><h2>Stability Level</h2>
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="returnvalue">GdaThreadWrapper</span></a> *
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-new" title="gda_thread_wrapper_new ()">gda_thread_wrapper_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="returnvalue">GIOChannel</span></a> *
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-io-channel" title="gda_thread_wrapper_get_io_channel ()">gda_thread_wrapper_get_io_channel</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-unset-io-channel" title="gda_thread_wrapper_unset_io_channel ()">gda_thread_wrapper_unset_io_channel</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperFunc" title="GdaThreadWrapperFunc ()">*GdaThreadWrapperFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()">gda_thread_wrapper_execute</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperVoidFunc" title="GdaThreadWrapperVoidFunc ()">*GdaThreadWrapperVoidFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()">gda_thread_wrapper_execute_void</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-cancel" title="gda_thread_wrapper_cancel ()">gda_thread_wrapper_cancel</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()">gda_thread_wrapper_iterate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()">gda_thread_wrapper_fetch_result</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-waiting-size" title="gda_thread_wrapper_get_waiting_size ()">gda_thread_wrapper_get_waiting_size</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperCallback" title="GdaThreadWrapperCallback ()">*GdaThreadWrapperCallback</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"><span class="returnvalue">gulong</span></a>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()">gda_thread_wrapper_connect_raw</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-disconnect" title="gda_thread_wrapper_disconnect ()">gda_thread_wrapper_disconnect</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-steal-signal" title="gda_thread_wrapper_steal_signal ()">gda_thread_wrapper_steal_signal</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapper-struct" title="struct GdaThreadWrapper">GdaThreadWrapper</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GdaThreadWrapper.html#GdaThreadNotification" title="GdaThreadNotification">GdaThreadNotification</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GdaThreadWrapper.html#GdaThreadNotificationType" title="enum GdaThreadNotificationType">GdaThreadNotificationType</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
    <span class="lineart">╰──</span> GdaThreadWrapper
</pre>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libgda/thread-wrapper/gda-thread-wrapper.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.description"></a><h2>Description</h2>
<p>The purpose of the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object is to execute functions in an isolated sub thread. As the
<a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> is thread safe, one is able to isolate some code's execution is a <span class="emphasis"><em>private</em></span>
<span class="emphasis"><em>worker</em></span> thread, and make a non thread safe code thread safe.</p>
<p>The downside of this is that the actual execution of the code will be slower as it requires
threads to be synchronized.</p>
<p>The <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> implements its own locking mechanism and can safely be used from multiple
threads at once without needing further locking.</p>
<p>Each thread using a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object can use it as if it was the only user: the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> will
simply dispatch all the execution requests to its private <span class="emphasis"><em>worker</em></span> thread and report the
execution's status only to the thread which made the request.</p>
<p>The user can also specify a callback function to be called when an object emits a signal while being
used by the worker thread, see the <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a> method.</p>
<p>The following diagram illustrates the conceptual working of the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object: here two user threads
are represented (assigned a red and green colors), both using a single <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a>, so in this diagram, 3 threads
are present. The communication between the threads are handled by some <a href="/usr/share/gtk-doc/html/glib/glib-Asynchronous-Queues.html#GAsyncQueue"><span class="type">GAsyncQueue</span></a> objects (in a transparent way for
the user, presented here only for illustration purposes). The queue represented in yellow is where jobs are
pushed by each user thread (step 1), and popped by the worker thread (step 2). Once the worker thread has finished
with a job, it stores the result along with the job and pushes it to the queue dedicated to the user thread
(step 3) in this example the red queue (because the job was issued from the thread represented in red). The last
step is when the user fetches the result (in its user thread), step 4.</p>
<p>If, when the worker thread is busy with a job, a signal is emitted, and if the user has set up a signal handler
using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>,
then a "job as signal" is created by the worker thread and pushed to the user thread as illustrated
at the bottom of the diagram.</p>
<div class="mediaobject"><img src="thread-wrapper.png" width="602" alt="GdaThreadWrapper's conceptual working"></div>
<p>It's the user's responsability to regularly check if a submitted job has completed
(using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>) or if a signal
has been emitted by an object while in the worker thread and needs to be handled by the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a>
to call the associated callback (using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a> or automatically done when
calling <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>).</p>
<p>However, when a main loop is available, the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> can emit notifications through a
<a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> which can be intregated in the main loop. The <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> can be created
using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-io-channel" title="gda_thread_wrapper_get_io_channel ()"><code class="function">gda_thread_wrapper_get_io_channel()</code></a>.</p>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gda-thread-wrapper-new"></a><h3>gda_thread_wrapper_new ()</h3>
<pre class="programlisting"><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="returnvalue">GdaThreadWrapper</span></a> *
gda_thread_wrapper_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p>
<div class="refsect3">
<a name="gda-thread-wrapper-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if threads are not supported/enabled</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-get-io-channel"></a><h3>gda_thread_wrapper_get_io_channel ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="returnvalue">GIOChannel</span></a> *
gda_thread_wrapper_get_io_channel (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>);</pre>
<p>Allow <em class="parameter"><code>wrapper</code></em>
 to notify when an execution job is finished, by making its exec ID
readable through a new <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>. This function is useful when the notification needs
to be included into a main loop. This also notifies that signals (emitted by objects in
<em class="parameter"><code>wrapper</code></em>
's internal thread) are available.</p>
<p>The returned <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> will have something to read everytime an execution job is finished
for an execution job submitted from the calling thread. The user whould read <a class="link" href="GdaThreadWrapper.html#GdaThreadNotification" title="GdaThreadNotification"><span class="type">GdaThreadNotification</span></a>
structures from the channel and analyse its contents to call <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a>
or <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>.</p>
<p>Note1: the new communication channel will only be operational for jobs submitted after this
function returns, and for signals which have been connected after this function returns. A safe
practice is to call this function before the <em class="parameter"><code>wrapper</code></em>
 object has been used.</p>
<p>Note2: this function will return the same <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> everytime it's called from the same thread.</p>
<p>Note3: if the usage of the returned <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> reveals an error, then <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#g-io-channel-shutdown"><code class="function">g_io_channel_shutdown()</code></a> and
<a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#g-io-channel-unref"><code class="function">g_io_channel_unref()</code></a> should be called on the <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> to let <em class="parameter"><code>wrapper</code></em>
 know it should not use
that object anymore.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-get-io-channel.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-get-io-channel.returns"></a><h4>Returns</h4>
<p>a new <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it could not be created. </p>
<p><span class="annotation">[<a href="http://foldoc.org/transfer%20none"><span class="acronym">transfer none</span></a>]</span></p>
</div>
<p class="since">Since: 4.2.9</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-unset-io-channel"></a><h3>gda_thread_wrapper_unset_io_channel ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gda_thread_wrapper_unset_io_channel (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>);</pre>
<p>Does the opposite of <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-io-channel" title="gda_thread_wrapper_get_io_channel ()"><code class="function">gda_thread_wrapper_get_io_channel()</code></a></p>
<div class="refsect3">
<a name="gda-thread-wrapper-unset-io-channel.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: 4.2.9</p>
</div>
<hr>
<div class="refsect2">
<a name="GdaThreadWrapperFunc"></a><h3>GdaThreadWrapperFunc ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
<span class="c_punctuation">(</span>*GdaThreadWrapperFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> arg</code></em>,
                         <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Specifies the type of function to be passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()"><code class="function">gda_thread_wrapper_execute()</code></a>.</p>
<div class="refsect3">
<a name="GdaThreadWrapperFunc.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>arg</p></td>
<td class="parameter_description"><p>pointer to the data (which is the <em class="parameter"><code>arg</code></em>
argument passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a place to store errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="GdaThreadWrapperFunc.returns"></a><h4>Returns</h4>
<p>a pointer to some data which will be returned by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-execute"></a><h3>gda_thread_wrapper_execute ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
gda_thread_wrapper_execute (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                            <em class="parameter"><code><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperFunc" title="GdaThreadWrapperFunc ()"><span class="type">GdaThreadWrapperFunc</span></a> func</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> arg</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> arg_destroy_func</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Make <em class="parameter"><code>wrapper</code></em>
 execute the <em class="parameter"><code>func</code></em>
 function with the <em class="parameter"><code>arg</code></em>
 argument (along with a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> which is not <em class="parameter"><code>error</code></em>
)
in the sub thread managed by <em class="parameter"><code>wrapper</code></em>
. To execute a function which does not return anything,
use <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a>.</p>
<p>This method returns immediately, and the caller then needs to use <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a> to
check if the execution has finished and get the result.</p>
<p>Once <em class="parameter"><code>func</code></em>
's execution is finished, if <em class="parameter"><code>arg</code></em>
 is not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the <em class="parameter"><code>arg_destroy_func</code></em>
 destruction function is called
on <em class="parameter"><code>arg</code></em>
. This call occurs in the thread calling <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>.</p>
<p>If an error occurred in this function, then the <em class="parameter"><code>arg_destroy_func</code></em>
 function is not called to free <em class="parameter"><code>arg</code></em>
.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-execute.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>the function to execute, not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>arg</p></td>
<td class="parameter_description"><p>argument to pass to <em class="parameter"><code>func</code></em>
, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/allow-none"><span class="acronym">allow-none</span></a>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>arg_destroy_func</p></td>
<td class="parameter_description"><p>function to be called when the execution has finished, to destroy <em class="parameter"><code>arg</code></em>
, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/allow-none"><span class="acronym">allow-none</span></a>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a place to store errors, for errors occurring in this method, not errors occurring while <em class="parameter"><code>func</code></em>
is executed, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-execute.returns"></a><h4>Returns</h4>
<p> the job ID, or 0 if an error occurred</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="GdaThreadWrapperVoidFunc"></a><h3>GdaThreadWrapperVoidFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
<span class="c_punctuation">(</span>*GdaThreadWrapperVoidFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> arg</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Specifies the type of function to be passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a>.</p>
<div class="refsect3">
<a name="GdaThreadWrapperVoidFunc.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>arg</p></td>
<td class="parameter_description"><p>a pointer to the data (which is the <em class="parameter"><code>arg</code></em>
argument passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a place to store errors</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-execute-void"></a><h3>gda_thread_wrapper_execute_void ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
gda_thread_wrapper_execute_void (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                                 <em class="parameter"><code><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperVoidFunc" title="GdaThreadWrapperVoidFunc ()"><span class="type">GdaThreadWrapperVoidFunc</span></a> func</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> arg</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> arg_destroy_func</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Make <em class="parameter"><code>wrapper</code></em>
 execute the <em class="parameter"><code>func</code></em>
 function with the <em class="parameter"><code>arg</code></em>
 argument (along with a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> which is not <em class="parameter"><code>error</code></em>
)
in the sub thread managed by <em class="parameter"><code>wrapper</code></em>
. To execute a function which returns some pointer,
use <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()"><code class="function">gda_thread_wrapper_execute()</code></a>.</p>
<p>This method returns immediately. Calling <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a> is not necessary as <em class="parameter"><code>func</code></em>

does not return any result. However, it may be necessary to call <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a> to give <em class="parameter"><code>wrapper</code></em>
 a
chance to execute the <em class="parameter"><code>arg_destroy_func</code></em>
 function if not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> (note that <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a> is
called by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a> itself).</p>
<p>Once <em class="parameter"><code>func</code></em>
's execution is finished, if <em class="parameter"><code>arg</code></em>
 is not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the <em class="parameter"><code>arg_destroy_func</code></em>
 destruction function is called
on <em class="parameter"><code>arg</code></em>
. This call occurs in the thread calling <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>.</p>
<p>If an error occurred in this function, then the <em class="parameter"><code>arg_destroy_func</code></em>
 function is not called to free <em class="parameter"><code>arg</code></em>
.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-execute-void.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>the function to execute, not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>arg</p></td>
<td class="parameter_description"><p>argument to pass to <em class="parameter"><code>func</code></em>
. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/allow-none"><span class="acronym">allow-none</span></a>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>arg_destroy_func</p></td>
<td class="parameter_description"><p>function to be called when the execution has finished, to destroy <em class="parameter"><code>arg</code></em>
, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/allow-none"><span class="acronym">allow-none</span></a>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a place to store errors, for errors occurring in this method, not errors occurring while <em class="parameter"><code>func</code></em>
is executed, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-execute-void.returns"></a><h4>Returns</h4>
<p> the job ID, or 0 if an error occurred</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-cancel"></a><h3>gda_thread_wrapper_cancel ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gda_thread_wrapper_cancel (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                           <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> id</code></em>);</pre>
<p>Cancels a job not yet executed. This may fail for the following reasons:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>the job <em class="parameter"><code>id</code></em> could not be found, either because it has already been treated or because
                 it does not exist or because it was created in another thread</p></li>
<li class="listitem"><p>the job <em class="parameter"><code>id</code></em> is currently being treated by the worker thread</p></li>
</ul></div>
<div class="refsect3">
<a name="gda-thread-wrapper-cancel.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>the ID of a job as returned by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()"><code class="function">gda_thread_wrapper_execute()</code></a> or <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-cancel.returns"></a><h4>Returns</h4>
<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the job has been cancelled, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> in any other case.</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-iterate"></a><h3>gda_thread_wrapper_iterate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gda_thread_wrapper_iterate (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                            <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> may_block</code></em>);</pre>
<p>This method gives <em class="parameter"><code>wrapper</code></em>
 a chance to check if some functions to be executed have finished
<span class="emphasis"><em>for the calling thread</em></span>. In this case it handles the execution result and
makes it ready to be processed using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-fetch-result" title="gda_thread_wrapper_fetch_result ()"><code class="function">gda_thread_wrapper_fetch_result()</code></a>.</p>
<p>This method also allows <em class="parameter"><code>wrapper</code></em>
 to handle signals which may have been emitted by objects
while in the worker thread, and call the callback function specified when <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>
was used.</p>
<p>If <em class="parameter"><code>may_block</code></em>
 is <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then it will block untill there is one finished execution 
(functions returning void and signals are ignored regarding this argument).</p>
<div class="refsect3">
<a name="gda-thread-wrapper-iterate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>may_block</p></td>
<td class="parameter_description"><p>whether the call may block</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-fetch-result"></a><h3>gda_thread_wrapper_fetch_result ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
gda_thread_wrapper_fetch_result (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> may_lock</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> exp_id</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Use this method to check if the execution of a function is finished. The function's execution must have
been requested using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()"><code class="function">gda_thread_wrapper_execute()</code></a>.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-fetch-result.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>may_lock</p></td>
<td class="parameter_description"><p>TRUE if this funct must lock the caller untill a result is available</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>exp_id</p></td>
<td class="parameter_description"><p>ID of the job for which a result is expected</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a place to store errors, for errors which may have occurred during the execution, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-fetch-result.returns"></a><h4>Returns</h4>
<p>the pointer returned by the execution, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no result is available. </p>
<p><span class="annotation">[<a href="http://foldoc.org/transfer%20none"><span class="acronym">transfer none</span></a>][<a href="http://foldoc.org/allow-none"><span class="acronym">allow-none</span></a>]</span></p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-get-waiting-size"></a><h3>gda_thread_wrapper_get_waiting_size ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
gda_thread_wrapper_get_waiting_size (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>);</pre>
<p>Use this method to query the number of functions which have been queued to be executed
but which have not yet been executed.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-get-waiting-size.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-get-waiting-size.returns"></a><h4>Returns</h4>
<p> the number of jobs not yet executed</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="GdaThreadWrapperCallback"></a><h3>GdaThreadWrapperCallback ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
<span class="c_punctuation">(</span>*GdaThreadWrapperCallback<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> instance</code></em>,
                             <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signame</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_param_values</code></em>,
                             <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/gobject/gobject-Generic-values.html#GValue-struct"><span class="type">GValue</span></a> *param_values</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> gda_reserved</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Specifies the type of function to be passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a></p>
<div class="refsect3">
<a name="GdaThreadWrapperCallback.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>the <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>instance</p></td>
<td class="parameter_description"><p>a pointer to the instance which emitted the signal</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>signame</p></td>
<td class="parameter_description"><p>the name of the signal being emitted</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n_param_values</p></td>
<td class="parameter_description"><p>number of GValue in <em class="parameter"><code>param_values</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>param_values</p></td>
<td class="parameter_description"><p>array of <em class="parameter"><code>n_param_values</code></em>
GValue</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>gda_reserved</p></td>
<td class="parameter_description"><p>reserved</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>a pointer to the data (which is the <em class="parameter"><code>data</code></em>
argument passed to <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-connect-raw"></a><h3>gda_thread_wrapper_connect_raw ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"><span class="returnvalue">gulong</span></a>
gda_thread_wrapper_connect_raw (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                                <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> instance</code></em>,
                                <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sig_name</code></em>,
                                <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> private_thread</code></em>,
                                <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> private_job</code></em>,
                                <em class="parameter"><code><a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperCallback" title="GdaThreadWrapperCallback ()"><span class="type">GdaThreadWrapperCallback</span></a> callback</code></em>,
                                <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Connects a callback function to a signal for a particular object. The difference with <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#g-signal-connect"><code class="function">g_signal_connect()</code></a> and
similar functions are:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>the <em class="parameter"><code>callback</code></em> argument is not a <a href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GCallback"><span class="type">GCallback</span></a> function, so the callback signature is not
   dependent on the signal itself</p></li>
<li class="listitem"><p>the signal handler must not have to return any value</p></li>
<li class="listitem"><p>the <em class="parameter"><code>callback</code></em> function will be called asynchronously, the caller may need to use 
   <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a> to get the notification</p></li>
<li class="listitem"><p>if <em class="parameter"><code>private_job</code></em> and <em class="parameter"><code>private_thread</code></em> control in which case the signal is propagated.</p></li>
</ul></div>
<p>Also note that signal handling is done asynchronously: when emitted in the worker thread, it
will be "queued" to be processed in the user thread when it has the chance (when <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-iterate" title="gda_thread_wrapper_iterate ()"><code class="function">gda_thread_wrapper_iterate()</code></a>
is called directly or indirectly). The side effect is that the callback function is usually
called long after the object emitting the signal has finished emitting it.</p>
<p>To disconnect a signal handler, don't use any of the g_signal_handler_*() functions but the
<a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-disconnect" title="gda_thread_wrapper_disconnect ()"><code class="function">gda_thread_wrapper_disconnect()</code></a> method.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-connect-raw.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>instance</p></td>
<td class="parameter_description"><p>the instance to connect to</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sig_name</p></td>
<td class="parameter_description"><p>a string of the form "signal-name::detail"</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>private_thread</p></td>
<td class="parameter_description"><p>set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>callback</code></em>
is to be invoked only if the signal has
been emitted while in <em class="parameter"><code>wrapper</code></em>
's private sub thread (ie. used when <em class="parameter"><code>wrapper</code></em>
is executing some functions
specified by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute" title="gda_thread_wrapper_execute ()"><code class="function">gda_thread_wrapper_execute()</code></a> or <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-execute-void" title="gda_thread_wrapper_execute_void ()"><code class="function">gda_thread_wrapper_execute_void()</code></a>), and to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the
callback is to be invoked whenever the signal is emitted, independently of the thread in which the
signal is emitted.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>private_job</p></td>
<td class="parameter_description"><p>set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>callback</code></em>
is to be invoked only if the signal has
been emitted when a job created for the calling thread is being executed, and to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
if <em class="parameter"><code>callback</code></em>
has to be called whenever the <em class="parameter"><code>sig_name</code></em>
signal is emitted by <em class="parameter"><code>instance</code></em>
. Note that
this argument is not taken into account if <em class="parameter"><code>private_thread</code></em>
is set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html#GdaThreadWrapperCallback" title="GdaThreadWrapperCallback ()"><span class="type">GdaThreadWrapperCallback</span></a> function. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/scope%20call"><span class="acronym">scope call</span></a>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>data to pass to <em class="parameter"><code>callback</code></em>
's calls. </p></td>
<td class="parameter_annotations"><span class="annotation">[<a href="http://foldoc.org/closure"><span class="acronym">closure</span></a>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gda-thread-wrapper-connect-raw.returns"></a><h4>Returns</h4>
<p> the handler ID</p>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-disconnect"></a><h3>gda_thread_wrapper_disconnect ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gda_thread_wrapper_disconnect (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                               <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> id</code></em>);</pre>
<p>Disconnects the emission of a signal, does the opposite of <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>.</p>
<p>As soon as this method returns, the callback function set when <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>
was called will not be called anymore (even if the object has emitted the signal in the worker
thread and this signal has not been handled in the user thread).</p>
<div class="refsect3">
<a name="gda-thread-wrapper-disconnect.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>a handler ID, as returned by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 4.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gda-thread-wrapper-steal-signal"></a><h3>gda_thread_wrapper_steal_signal ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gda_thread_wrapper_steal_signal (<em class="parameter"><code><a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> *wrapper</code></em>,
                                 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> id</code></em>);</pre>
<p>Requests that the signal which ID is <em class="parameter"><code>id</code></em>
 (which has been obtained using <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>)
be treated by the calling thread instead of by the thread in which <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-connect-raw" title="gda_thread_wrapper_connect_raw ()"><code class="function">gda_thread_wrapper_connect_raw()</code></a>
was called.</p>
<div class="refsect3">
<a name="gda-thread-wrapper-steal-signal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>wrapper</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdaThreadWrapper.html" title="GdaThreadWrapper"><span class="type">GdaThreadWrapper</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>a signal ID</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 4.2</p>
</div>
</div>
<div class="refsect1">
<a name="GdaThreadWrapper.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GdaThreadWrapper-struct"></a><h3>struct GdaThreadWrapper</h3>
<pre class="programlisting">struct GdaThreadWrapper;</pre>
</div>
<hr>
<div class="refsect2">
<a name="GdaThreadNotification"></a><h3>GdaThreadNotification</h3>
<pre class="programlisting">typedef struct {
	GdaThreadNotificationType type;
	guint                     job_id;
} GdaThreadNotification;
</pre>
<p>A notification to be read through the <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> which is returned by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-io-channel" title="gda_thread_wrapper_get_io_channel ()"><code class="function">gda_thread_wrapper_get_io_channel()</code></a>,
for example:</p>
<pre class="programlisting">
gboolean
wrapper_ioc_cb (GIOChannel *source, GIOCondition condition, gpointer data)
{
    GIOStatus status;
    gsize nread;
    GdaThreadNotification notif;
    if (condition &amp; G_IO_IN) {
   status = g_io_channel_read_chars (source, (gchar*) &amp;notif, sizeof (notif), &amp;nread, NULL);
        if ((status != G_IO_STATUS_NORMAL) || (nread != sizeof (notif)))
            goto onerror;
   switch (notif.type) {
   case GDA_THREAD_NOTIFICATION_JOB:
            check_for_wrapper_result (bcnc);
            break;
        case GDA_THREAD_NOTIFICATION_SIGNAL:
            gda_thread_wrapper_iterate (bcnc-&gt;priv-&gt;wrapper, FALSE);
            break;
        default:
            goto onerror;
            break;
   }
  }
  if (condition &amp; (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
            goto onerror;
  return TRUE; // keep callback

onerror:
  g_io_channel_shutdown (bcnc-&gt;priv-&gt;ioc, FALSE, NULL);
  return FALSE; // removed callback
}

{
[...]
    GIOChannel *ioc;
    ioc = gda_thread_wrapper_get_io_channel (wrapper);
    if (!ioc)
        [handle error]
    else {
        guint watch_id;
        watch_id = g_io_add_watch (ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
                                   (GIOFunc) wrapper_ioc_cb, NULL);
    }
}
</pre>
<div class="refsect3">
<a name="GdaThreadNotification.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><a class="link" href="GdaThreadWrapper.html#GdaThreadNotificationType" title="enum GdaThreadNotificationType"><span class="type">GdaThreadNotificationType</span></a> <em class="structfield"><code><a name="GdaThreadNotification.type"></a>type</code></em>;</p></td>
<td class="struct_member_description"><p>the notification type</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GdaThreadNotification.job-id"></a>job_id</code></em>;</p></td>
<td class="struct_member_description"><p>the job ID, if <em class="parameter"><code>type</code></em>
is a <a class="link" href="GdaThreadWrapper.html#GDA-THREAD-NOTIFICATION-JOB:CAPS"><span class="type">GDA_THREAD_NOTIFICATION_JOB</span></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GdaThreadNotificationType"></a><h3>enum GdaThreadNotificationType</h3>
<p>Defines the kind of notification which can be obtained when reading from te <a href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
returned by <a class="link" href="GdaThreadWrapper.html#gda-thread-wrapper-get-io-channel" title="gda_thread_wrapper_get_io_channel ()"><code class="function">gda_thread_wrapper_get_io_channel()</code></a>.</p>
<div class="refsect3">
<a name="GdaThreadNotificationType.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="GDA-THREAD-NOTIFICATION-JOB:CAPS"></a>GDA_THREAD_NOTIFICATION_JOB</p></td>
<td class="enum_member_description">
<p>the notification regards a job finished</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GDA-THREAD-NOTIFICATION-SIGNAL:CAPS"></a>GDA_THREAD_NOTIFICATION_SIGNAL</p></td>
<td class="enum_member_description">
<p>the notification regards a signal</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>