-
Notifications
You must be signed in to change notification settings - Fork 0
/
qt5reactor_threads.py.html
1214 lines (994 loc) · 90.9 KB
/
qt5reactor_threads.py.html
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
<!DOCTYPE html>
<!-- saved from url=(0096)https://gist.github.com/altendky/faf48446c335418dac8793635d119750#file-qt5reactor_threads_run-py -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="dns-prefetch" href="https://github.githubassets.com/">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com/">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com/">
<link rel="dns-prefetch" href="https://avatars2.githubusercontent.com/">
<link rel="dns-prefetch" href="https://avatars3.githubusercontent.com/">
<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com/">
<link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">
<link crossorigin="anonymous" media="all" integrity="sha512-TD/1gdStKo77Iu1A+WNb+2YoRJv7l1hZVO0/0h+eJ5wyGxiTvIbLRko1dQ1jEa9w5BK3poi18st9OPel71zK8A==" rel="stylesheet" href="./qt5reactor_threads.py_files/frameworks-94d2de65a56b07e193e50e91873678b6.css">
<link crossorigin="anonymous" media="all" integrity="sha512-PRyH3JXhrP/yiSCrUGEj/ghjek3lYeFEX2pXS+XaC4ENkLiDiEXKL8H2w/SLXWGh4hHx3FTBouYYsR5ypWKpqw==" rel="stylesheet" href="./qt5reactor_threads.py_files/github-731c9b196d43ff9599a770850575fcca.css">
<meta name="viewport" content="width=device-width">
<title>qt5reactor_threads.py</title>
<meta name="description" content="GitHub Gist: instantly share code, notes, and snippets.">
<link rel="search" type="application/opensearchdescription+xml" href="https://gist.github.com/opensearch-gist.xml" title="Gist">
<link rel="fluid-icon" href="https://gist.github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta name="twitter:image:src" content="https://github.githubassets.com/images/modules/gists/gist-og-image.png"><meta name="twitter:site" content="@github"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="qt5reactor_threads.py"><meta name="twitter:description" content="GitHub Gist: instantly share code, notes, and snippets.">
<meta property="og:image" content="https://github.githubassets.com/images/modules/gists/gist-og-image.png"><meta property="og:site_name" content="Gist"><meta property="og:type" content="article"><meta property="og:title" content="qt5reactor_threads.py"><meta property="og:url" content="https://gist.github.com/altendky/faf48446c335418dac8793635d119750"><meta property="og:description" content="GitHub Gist: instantly share code, notes, and snippets."><meta property="article:author" content="262588213843476"><meta property="article:publisher" content="262588213843476">
<link rel="assets" href="https://github.githubassets.com/">
<link rel="web-socket" href="wss://live.github.com/_sockets/VjI6NDU5NTg1Mzk1OmNhNDk5Yzk0MTkzNzhiMjcyMjRmNDkwNzA2NTEwZTYyYjBlYjc0ZTU5OWQ3OWU5YzRjMmNkYTY4OWFlZTFiYjM=--b612cd62a28953dfd4d5d07215bd6064cbe5ff8c">
<link rel="sudo-modal" href="https://gist.github.com/sessions/sudo_modal">
<meta name="request-id" content="EF06:0C17:B04709:1675177:5DB14E19" data-pjax-transient="">
<meta name="selected-link" value="gist_code" data-pjax-transient="">
<meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
<meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc">
<meta name="octolytics-host" content="collector.githubapp.com"><meta name="octolytics-app-id" content="gist"><meta name="octolytics-event-url" content="https://collector.githubapp.com/github-external/browser_event"><meta name="octolytics-dimension-request_id" content="EF06:0C17:B04709:1675177:5DB14E19"><meta name="octolytics-dimension-region_edge" content="iad"><meta name="octolytics-dimension-region_render" content="iad"><meta name="octolytics-dimension-ga_id" content="" class="js-octo-ga-id"><meta name="octolytics-dimension-visitor_id" content="3114435144723325634"><meta name="octolytics-actor-id" content="61786"><meta name="octolytics-actor-login" content="inhahe"><meta name="octolytics-actor-hash" content="3a06b47d2dd8beab6826cfd6c34ac66da9f8fb1ad3f02ad1569d065207b0775d">
<meta name="analytics-location" content="/<user-name>/<gist-id>" data-pjax-transient="true">
<meta name="google-analytics" content="UA-3769691-4">
<meta class="js-ga-set" name="userId" content="2b7588b0b701eb57b6af4d4c939b46d2">
<meta class="js-ga-set" name="dimension1" content="Logged In">
<meta name="octolytics-dimension-public" content="true"><meta name="octolytics-dimension-gist_id" content="43890587"><meta name="octolytics-dimension-gist_name" content="faf48446c335418dac8793635d119750"><meta name="octolytics-dimension-anonymous" content="false"><meta name="octolytics-dimension-owner_id" content="543719"><meta name="octolytics-dimension-owner_login" content="altendky"><meta name="octolytics-dimension-forked" content="false">
<meta class="js-ga-set" name="dimension5" content="public">
<meta class="js-ga-set" name="dimension6" content="owned">
<meta class="js-ga-set" name="dimension7" content="python">
<meta name="hostname" content="gist.github.com">
<meta name="user-login" content="inhahe">
<meta name="expected-hostname" content="gist.github.com">
<meta name="js-proxy-site-detection-payload" content="OTY1MWRhYWIxOTIwODMyMjk0YzhkNDFkZWE1NjM2ZGUyYjUyZjJkYWJlZWZkZTEwMWMzMzhhNGY0MDljNWI3NHx7InJlbW90ZV9hZGRyZXNzIjoiMTA4LjI0Ni43NC4yNDIiLCJyZXF1ZXN0X2lkIjoiRUYwNjowQzE3OkIwNDcwOToxNjc1MTc3OjVEQjE0RTE5IiwidGltZXN0YW1wIjoxNTcxOTAwOTU0LCJob3N0IjoiZ2l0aHViLmNvbSJ9">
<meta name="enabled-features" content="ACTIONS_V2_ON_MARKETPLACE,MARKETPLACE_FEATURED_BLOG_POSTS,MARKETPLACE_INVOICED_BILLING,MARKETPLACE_SOCIAL_PROOF_CUSTOMERS,MARKETPLACE_TRENDING_SOCIAL_PROOF,MARKETPLACE_RECOMMENDATIONS,MARKETPLACE_PENDING_INSTALLATIONS,NOTIFY_ON_BLOCK,RELATED_ISSUES,GHE_CLOUD_TRIAL">
<meta name="html-safe-nonce" content="1811e8b9280f72f1996fd403269194e693f4b8ce">
<meta http-equiv="x-pjax-version" content="67d3257f1acfc3f77a3a97eb3c859631">
<link href="https://gist.github.com/altendky.atom" rel="alternate" title="atom" type="application/atom+xml">
<link crossorigin="anonymous" media="all" integrity="sha512-eugfgjBp0ZgIOWm2vVumT2BtsOo+aZto75qwqV3mlYwSC8XIXu6PRH6hh5ms6HN2RbBii0M8cnK9UuJLO3Cyew==" rel="stylesheet" href="./qt5reactor_threads.py_files/gist-04c9f30b6b426947b013a993ce8747c8.css">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000">
<link rel="icon" type="image/x-icon" class="js-site-favicon" href="https://github.githubassets.com/favicon.ico">
<meta name="theme-color" content="#1e2327">
<meta name="webauthn-auth-enabled" content="true">
<meta name="webauthn-registration-enabled" content="true">
</head>
<body class="logged-in env-production min-width-lg">
<div class="position-relative js-header-wrapper ">
<a href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750#start-of-content" tabindex="1" class="p-3 bg-blue text-white show-on-focus js-skip-to-content">Skip to content</a>
<span class="Progress progress-pjax-loader position-fixed width-full js-pjax-loader-bar">
<span class="progress-pjax-loader-bar top-0 left-0" style="width: 0%;"></span>
</span>
<div class="Header" role="banner">
<div class="Header-item">
<a class="Header-link" data-hotkey="g d" aria-label="Gist Homepage" href="https://gist.github.com/">
<svg class="octicon octicon-mark-github v-align-middle d-none" height="24" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
<svg height="24" class="octicon octicon-logo-github v-align-middle" viewBox="0 0 45 16" version="1.1" width="67" aria-hidden="true"><path fill-rule="evenodd" d="M18.53 12.03h-.02c.009 0 .015.01.024.011h.006l-.01-.01zm.004.011c-.093.001-.327.05-.574.05-.78 0-1.05-.36-1.05-.83V8.13h1.59c.09 0 .16-.08.16-.19v-1.7c0-.09-.08-.17-.16-.17h-1.59V3.96c0-.08-.05-.13-.14-.13h-2.16c-.09 0-.14.05-.14.13v2.17s-1.09.27-1.16.28c-.08.02-.13.09-.13.17v1.36c0 .11.08.19.17.19h1.11v3.28c0 2.44 1.7 2.69 2.86 2.69.53 0 1.17-.17 1.27-.22.06-.02.09-.09.09-.16v-1.5a.177.177 0 00-.146-.18zM42.23 9.84c0-1.81-.73-2.05-1.5-1.97-.6.04-1.08.34-1.08.34v3.52s.49.34 1.22.36c1.03.03 1.36-.34 1.36-2.25zm2.43-.16c0 3.43-1.11 4.41-3.05 4.41-1.64 0-2.52-.83-2.52-.83s-.04.46-.09.52c-.03.06-.08.08-.14.08h-1.48c-.1 0-.19-.08-.19-.17l.02-11.11c0-.09.08-.17.17-.17h2.13c.09 0 .17.08.17.17v3.77s.82-.53 2.02-.53l-.01-.02c1.2 0 2.97.45 2.97 3.88zm-8.72-3.61h-2.1c-.11 0-.17.08-.17.19v5.44s-.55.39-1.3.39-.97-.34-.97-1.09V6.25c0-.09-.08-.17-.17-.17h-2.14c-.09 0-.17.08-.17.17v5.11c0 2.2 1.23 2.75 2.92 2.75 1.39 0 2.52-.77 2.52-.77s.05.39.08.45c.02.05.09.09.16.09h1.34c.11 0 .17-.08.17-.17l.02-7.47c0-.09-.08-.17-.19-.17zm-23.7-.01h-2.13c-.09 0-.17.09-.17.2v7.34c0 .2.13.27.3.27h1.92c.2 0 .25-.09.25-.27V6.23c0-.09-.08-.17-.17-.17zm-1.05-3.38c-.77 0-1.38.61-1.38 1.38 0 .77.61 1.38 1.38 1.38.75 0 1.36-.61 1.36-1.38 0-.77-.61-1.38-1.36-1.38zm16.49-.25h-2.11c-.09 0-.17.08-.17.17v4.09h-3.31V2.6c0-.09-.08-.17-.17-.17h-2.13c-.09 0-.17.08-.17.17v11.11c0 .09.09.17.17.17h2.13c.09 0 .17-.08.17-.17V8.96h3.31l-.02 4.75c0 .09.08.17.17.17h2.13c.09 0 .17-.08.17-.17V2.6c0-.09-.08-.17-.17-.17zM8.81 7.35v5.74c0 .04-.01.11-.06.13 0 0-1.25.89-3.31.89-2.49 0-5.44-.78-5.44-5.92S2.58 1.99 5.1 2c2.18 0 3.06.49 3.2.58.04.05.06.09.06.14L7.94 4.5c0 .09-.09.2-.2.17-.36-.11-.9-.33-2.17-.33-1.47 0-3.05.42-3.05 3.73s1.5 3.7 2.58 3.7c.92 0 1.25-.11 1.25-.11v-2.3H4.88c-.11 0-.19-.08-.19-.17V7.35c0-.09.08-.17.19-.17h3.74c.11 0 .19.08.19.17z"></path></svg>
<svg height="24" class="octicon octicon-logo-gist v-align-middle" viewBox="0 0 25 16" version="1.1" width="37" aria-hidden="true"><path fill-rule="evenodd" d="M4.7 8.73h2.45v4.02c-.55.27-1.64.34-2.53.34-2.56 0-3.47-2.2-3.47-5.05 0-2.85.91-5.06 3.48-5.06 1.28 0 2.06.23 3.28.73V2.66C7.27 2.33 6.25 2 4.63 2 1.13 2 0 4.69 0 8.03c0 3.34 1.11 6.03 4.63 6.03 1.64 0 2.81-.27 3.59-.64V7.73H4.7v1zm6.39 3.72V6.06h-1.05v6.28c0 1.25.58 1.72 1.72 1.72v-.89c-.48 0-.67-.16-.67-.7v-.02zm.25-8.72c0-.44-.33-.78-.78-.78s-.77.34-.77.78.33.78.77.78.78-.34.78-.78zm4.34 5.69c-1.5-.13-1.78-.48-1.78-1.17 0-.77.33-1.34 1.88-1.34 1.05 0 1.66.16 2.27.36v-.94c-.69-.3-1.52-.39-2.25-.39-2.2 0-2.92 1.2-2.92 2.31 0 1.08.47 1.88 2.73 2.08 1.55.13 1.77.63 1.77 1.34 0 .73-.44 1.42-2.06 1.42-1.11 0-1.86-.19-2.33-.36v.94c.5.2 1.58.39 2.33.39 2.38 0 3.14-1.2 3.14-2.41 0-1.28-.53-2.03-2.75-2.23h-.03zm8.58-2.47v-.86h-2.42v-2.5l-1.08.31v2.11l-1.56.44v.48h1.56v5c0 1.53 1.19 2.13 2.5 2.13.19 0 .52-.02.69-.05v-.89c-.19.03-.41.03-.61.03-.97 0-1.5-.39-1.5-1.34V6.94h2.42v.02-.01z"></path></svg>
</a>
</div>
<div class="Header-item Header-item--full js-site-search">
<div class="header-search mr-3">
<!-- '"` --><!-- </textarea></xmp> --><form class="position-relative js-quicksearch-form" role="search" aria-label="Site" action="https://gist.github.com/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓">
<div class="header-search-wrapper form-control input-sm js-chromeless-input-container">
<input type="text" class="form-control input-sm js-site-search-focus header-search-input js-navigation-enable js-quicksearch-field" data-hotkey="s,/" name="q" aria-label="Search" placeholder="Search…" autocorrect="off" autocomplete="off" autocapitalize="off">
</div>
<div class="gist-quicksearch-results js-quicksearch-results js-navigation-container" data-quicksearch-url="/search/quick"></div>
</form></div>
<nav aria-label="Global" class="d-flex">
<a class="Header-link mr-3" data-ga-click="Header, go to all gists, text:all gists" href="https://gist.github.com/discover">All gists</a>
<a class="Header-link mr-3" data-ga-click="Header, go to GitHub, text:Back to GitHub" href="https://github.com/">Back to GitHub</a>
</nav>
</div>
<div class="Header-item ">
<a aria-label="You have unread notifications" class="Header-link notification-indicator position-relative tooltipped tooltipped-s js-socket-channel js-notification-indicator" data-hotkey="g n" data-ga-click="Header, go to notifications, icon:unread" data-channel="notification-changed:61786" href="https://github.com/notifications">
<span class="mail-status unread"></span>
<svg class="octicon octicon-bell" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M14 12v1H0v-1l.73-.58c.77-.77.81-2.55 1.19-4.42C2.69 3.23 6 2 6 2c0-.55.45-1 1-1s1 .45 1 1c0 0 3.39 1.23 4.16 5 .38 1.88.42 3.66 1.19 4.42l.66.58H14zm-7 4c1.11 0 2-.89 2-2H5c0 1.11.89 2 2 2z"></path></svg>
</a> </div>
<div class="Header-item ">
<a class="Header-link" data-ga-click="Header, go to new gist, text:new gist" aria-label="Create new gist" href="https://gist.github.com/">
<svg class="octicon octicon-plus" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5v2z"></path></svg>
</a> </div>
<div class="Header-item position-relative mr-0" id="user-links">
<details class="details-overlay details-reset">
<summary class="Header-link name" aria-label="View profile and more" data-ga-click="Header, show menu, icon:avatar" aria-haspopup="menu" role="button">
<img class="avatar" src="./qt5reactor_threads.py_files/61786" width="20" height="20" alt="@inhahe">
<span class="dropdown-caret"></span>
</summary>
<details-menu class="dropdown-menu dropdown-menu-sw" style="width: 180px" role="menu">
<div class="css-truncate"><a role="menuitem" class="text-gray-dark no-underline px-3 pt-2 pb-2 mb-n2 mt-n1 d-block" href="https://gist.github.com/inhahe" data-ga-click="Header, go to profile, text:Signed in as">Signed in as <strong class="css-truncate-target">inhahe</strong></a></div>
<div role="none" class="dropdown-divider"></div>
<a role="menuitem" class="dropdown-item" href="https://gist.github.com/inhahe" data-ga-click="Header, go to your gists, text:your gists">Your gists</a>
<a role="menuitem" class="dropdown-item" href="https://gist.github.com/inhahe/starred" data-ga-click="Header, go to starred gists, text:starred gists">Starred gists</a>
<a role="menuitem" class="dropdown-item" href="https://help.github.com/" data-ga-click="Header, go to help, text:help">Help</a>
<div role="none" class="dropdown-divider"></div>
<a role="menuitem" class="dropdown-item" href="https://github.com/inhahe" data-ga-click="Header, go to profile, text:your profile">Your GitHub profile</a>
<!-- '"` --><!-- </textarea></xmp> --><form class="logout-form" action="https://gist.github.com/auth/github/logout" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="20dITk2CXnrptjZavQdE1ckvEpVAw4DCZ1ElbM7Li15V+w+KBJxX8tDatXuXg7eQCvNt9ablXxDz74nWnziVyA==">
<button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout" role="menuitem">
Sign out
</button>
</form> </details-menu>
</details>
</div>
</div>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div id="js-flash-container">
</div>
<div class="application-main " data-commit-hovercards-enabled="">
<div itemscope="" itemtype="http://schema.org/Code">
<main id="gist-pjax-container" class="gist-content-wrapper" data-pjax-container="">
<div class="gisthead pagehead repohead instapaper_ignore readability-menu experiment-repo-nav pt-3 mb-4">
<div class="container-lg px-3">
<div class="mb-3 d-flex">
<h1 class="public css-truncate float-none flex-auto width-fit pl-0">
<a class="avatar mr-1" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=543719" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://gist.github.com/altendky"><img src="./qt5reactor_threads.py_files/543719" width="26" height="26" alt="@altendky"></a>
<span class="author"><a data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=543719" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://gist.github.com/altendky">altendky</a></span><!--
--><span class="path-divider">/</span><!--
--><strong itemprop="name" class="css-truncate-target" style="max-width: 410px"><a href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750">qt5reactor_threads.py</a></strong>
<div class="d-block text-small text-gray">
Last active <time-ago datetime="2017-05-18T21:09:04Z" class="no-wrap" title="May 18, 2017, 5:09 PM EDT">3 years ago</time-ago>
•
<a class="text-gray" href="https://gist.github.com/contact/report-content?content_url=https%3A%2F%2Fgist.github.com%2Ffaf48446c335418dac8793635d119750&report=altendky+%28user%29">Report abuse</a>
</div>
</h1>
<ul class="pagehead-actions float-none">
<li>
<div class="thread-subscription-status js-socket-channel js-updatable-content" data-replace-remote-form-target="" data-channel="list-subscription:user:543719:61786 thread-subscription:43890587:61786" data-url="/altendky/faf48446c335418dac8793635d119750/subscription">
<svg height="32" class="octicon octicon-radio-tower" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M4.79 6.11c.25-.25.25-.67 0-.92-.32-.33-.48-.76-.48-1.19 0-.43.16-.86.48-1.19.25-.26.25-.67 0-.92a.613.613 0 00-.45-.19c-.16 0-.33.06-.45.19-.57.58-.85 1.35-.85 2.11 0 .76.29 1.53.85 2.11.25.25.66.25.9 0zM2.33.52a.651.651 0 00-.92 0C.48 1.48.01 2.74.01 3.99c0 1.26.47 2.52 1.4 3.48.25.26.66.26.91 0s.25-.68 0-.94c-.68-.7-1.02-1.62-1.02-2.54 0-.92.34-1.84 1.02-2.54a.66.66 0 00.01-.93zm5.69 5.1A1.62 1.62 0 106.4 4c-.01.89.72 1.62 1.62 1.62zM14.59.53a.628.628 0 00-.91 0c-.25.26-.25.68 0 .94.68.7 1.02 1.62 1.02 2.54 0 .92-.34 1.83-1.02 2.54-.25.26-.25.68 0 .94a.651.651 0 00.92 0c.93-.96 1.4-2.22 1.4-3.48A5.048 5.048 0 0014.59.53zM8.02 6.92c-.41 0-.83-.1-1.2-.3l-3.15 8.37h1.49l.86-1h4l.84 1h1.49L9.21 6.62c-.38.2-.78.3-1.19.3zm-.01.48L9.02 11h-2l.99-3.6zm-1.99 5.59l1-1h2l1 1h-4zm5.19-11.1c-.25.25-.25.67 0 .92.32.33.48.76.48 1.19 0 .43-.16.86-.48 1.19-.25.26-.25.67 0 .92a.63.63 0 00.9 0c.57-.58.85-1.35.85-2.11 0-.76-.28-1.53-.85-2.11a.634.634 0 00-.9 0z"></path></svg>
<!-- '"` --><!-- </textarea></xmp> --><form data-replace-remote-form="true" class="thread-subscribe-form" action="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/subscribe" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="q7eWtV7W0j9TYxjju4t2SPiBoo6n0+PUVAWQPR7FPDxWHEKekrXn5o5kufSidDQbAU77wUt9X1lWj4SDuCjRnw=="> <input type="hidden" name="repository_id" value="543719">
<input type="hidden" name="thread_id" value="43890587">
<input type="hidden" name="thread_class" value="Gist">
<input type="hidden" name="id" value="subscribe">
<button type="submit" class="btn btn-block btn-sm" data-disable-with="">
<svg class="octicon octicon-unmute" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 8.02c0 1.09-.45 2.09-1.17 2.83l-.67-.67c.55-.56.89-1.31.89-2.16 0-.85-.34-1.61-.89-2.16l.67-.67A3.99 3.99 0 0112 8.02zM7.72 2.28L4 6H2c-.55 0-1 .45-1 1v2c0 .55.45 1 1 1h2l3.72 3.72c.47.47 1.28.14 1.28-.53V2.81c0-.67-.81-1-1.28-.53zm5.94.08l-.67.67a6.996 6.996 0 012.06 4.98c0 1.94-.78 3.7-2.06 4.98l.67.67A7.973 7.973 0 0016 8c0-2.22-.89-4.22-2.34-5.66v.02zm-1.41 1.41l-.69.67a5.05 5.05 0 011.48 3.58c0 1.39-.56 2.66-1.48 3.56l.69.67A5.971 5.971 0 0014 8.02c0-1.65-.67-3.16-1.75-4.25z"></path></svg> Subscribe
</button>
</form></div>
</li>
<li>
<div class="js-toggler-container js-social-container starring-container ">
<!-- '"` --><!-- </textarea></xmp> --><form class="starred js-social-form" action="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/unstar" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="6zzPVIUymX7DVoFRCYGhs1L150LQDJDryS+0XJD+gG51GStrCosJHlmRPTIVMVvWJ5HOjyWCdWFd3wTrohLrMA==">
<input type="hidden" name="context" value="gist">
<button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this gist" title="Unstar altendky/faf48446c335418dac8793635d119750" data-ga-click="Repository, click unstar button, action:gists/gists#show; text:Unstar"> <svg class="octicon octicon-star v-align-text-bottom" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"></path></svg>
Unstar
</button> <a class="social-count js-social-count" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/stargazers" aria-label="0 users starred this repository">
0
</a>
</form>
<!-- '"` --><!-- </textarea></xmp> --><form class="unstarred js-social-form" action="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/star" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="l3OZLavPJDKgjYu4ei1OSQHFjV2xyeL/7o+2d+CZO2bvklo+yLXdBTIQcYghLx79Ef0pCsOYBcyYe+L2PhxiuQ==">
<input type="hidden" name="context" value="gist">
<button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this gist" title="Star altendky/faf48446c335418dac8793635d119750" data-ga-click="Repository, click star button, action:gists/gists#show; text:Star"> <svg class="octicon octicon-star v-align-text-bottom" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"></path></svg>
Star
</button> <a class="social-count js-social-count" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/stargazers" aria-label="0 users starred this repository">
0
</a>
</form> </div>
</li>
<li>
<!-- '"` --><!-- </textarea></xmp> --><form action="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/fork" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="gzisKSwLhQk37QGzY3Iq04xqvd8oT1mUJSRU8Cgkq/dAMtk/XjVTcdwWTcPeaTZp4RMjEx+Z4zTQ1eFq11/DGw==">
<button class="btn btn-sm btn-with-count" type="submit">
<svg class="octicon octicon-repo-forked" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 00-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 002 1a1.993 1.993 0 00-1 3.72V6.5l3 3v1.78A1.993 1.993 0 005 15a1.993 1.993 0 001-3.72V9.5l3-3V4.72A1.993 1.993 0 008 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
Fork
</button>
<span class="social-count">0</span>
</form>
</li>
</ul>
</div>
<div class="d-flex">
<div class="flex-auto">
<nav class="reponav js-repo-nav js-sidenav-container-pjax" aria-label="Gist" data-pjax="#gist-pjax-container">
<a class="js-selected-navigation-item selected reponav-item" data-pjax="true" data-hotkey="g c" aria-current="page" data-selected-links="gist_code /altendky/faf48446c335418dac8793635d119750" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750">
<svg class="octicon octicon-code" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
Code
</a>
<a class="js-selected-navigation-item reponav-item" data-pjax="true" data-hotkey="g r" data-selected-links="gist_revisions /altendky/faf48446c335418dac8793635d119750/revisions" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/revisions">
<svg class="octicon octicon-git-commit" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"></path></svg>
Revisions
<span class="Counter">2</span>
</a>
</nav>
</div>
<div class="file-navigation-options" data-multiple="">
<div class="file-navigation-option v-align-middle">
<div class="input-group">
<div class="input-group-button">
<details class="details-reset details-overlay select-menu">
<summary class="btn btn-sm select-menu-button" data-ga-click="Repository, clone Embed, location:repo overview" aria-haspopup="menu" role="button">
<span data-menu-button="">Embed</span>
</summary>
<details-menu class="select-menu-modal position-absolute" data-menu-input="gist-share-url" style="z-index: 99;" aria-label="Clone options" role="menu">
<div class="select-menu-header">
<span class="select-menu-title">What would you like to do?</span>
</div>
<div class="select-menu-list">
<button name="button" type="button" class="select-menu-item width-full" aria-checked="true" role="menuitemradio" value="<script src="https://gist.github.com/altendky/faf48446c335418dac8793635d119750.js"></script>" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"EMBED","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="5873009bafc44dbfee89beefe1974edaa130d1ad32bf6fdb042e3e0940b1a8e3">
<svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Embed
</span>
<span class="description">
Embed this gist in your website.
</span>
</div>
</button> <button name="button" type="button" class="select-menu-item width-full" aria-checked="false" role="menuitemradio" value="https://gist.github.com/altendky/faf48446c335418dac8793635d119750" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"SHARE","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="e7a701e0fb63ae4c3bb05566469b70989db2c73fbeb61f1167de1e9eca373f05">
<svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Share
</span>
<span class="description">
Copy sharable link for this gist.
</span>
</div>
</button> <button name="button" type="button" class="select-menu-item width-full" aria-checked="false" role="menuitemradio" value="https://gist.github.com/faf48446c335418dac8793635d119750.git" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"USE_HTTPS","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="c9bc1598916fe5fe313e546b5bfb774c8e902deeec637a0ddf1b131dc6fd30aa">
<svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Clone via
HTTPS
</span>
<span class="description">
Clone with Git or checkout with SVN using the repository’s web address.
</span>
</div>
</button> <button name="button" type="button" class="select-menu-item width-full" aria-checked="false" role="menuitemradio" value="[email protected]:faf48446c335418dac8793635d119750.git" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"USE_SSH","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="598e9c0979fd23dcc4f3490952e3af9fce414c56caca504b052ec88c4e9e2db1">
<svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Clone via
SSH
</span>
<span class="description">
Clone with an SSH key and passphrase from your GitHub settings.
</span>
</div>
</button> </div>
<div class="select-menu-list">
<a role="menuitem" class="select-menu-item select-menu-action" href="https://help.github.com/articles/which-remote-url-should-i-use" target="_blank">
<svg class="octicon octicon-question select-menu-item-icon" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M6 10h2v2H6v-2zm4-3.5C10 8.64 8 9 8 9H6c0-.55.45-1 1-1h.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5V7H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 011.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7z"></path></svg>
<div class="select-menu-item-text">
Learn more about clone URLs
</div>
</a>
</div>
</details-menu>
</details>
</div>
<input id="gist-share-url" type="text" data-autoselect="" class="form-control input-monospace input-sm" value="<script src="https://gist.github.com/altendky/faf48446c335418dac8793635d119750.js"></script>" aria-label="Clone this repository at <script src="https://gist.github.com/altendky/faf48446c335418dac8793635d119750.js"></script>" readonly="">
<div class="input-group-button">
<clipboard-copy for="gist-share-url" aria-label="Copy to clipboard" class="btn btn-sm zeroclipboard-button" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"COPY_URL","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="fa0f1a4e6fb56fd1dd1fe7e5ce53961268e1f685a7e3fbaa768681604cd191e3" tabindex="0" role="button"><svg class="octicon octicon-clippy" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"></path></svg></clipboard-copy>
</div>
</div>
</div>
<div class="file-navigation-option">
<a class="btn btn-sm tooltipped tooltipped-s tooltipped-multiline" aria-label="Save altendky/faf48446c335418dac8793635d119750 to your computer and use it in GitHub Desktop." data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"OPEN_IN_DESKTOP","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="a7044797f6110c7d6c043ea14d8d60e0bb8ee34d0c2b649b3249a2cdfb902b4d" href="x-github-client://openRepo/https://gist.github.com/faf48446c335418dac8793635d119750"><svg class="octicon octicon-desktop-download" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 6h3V0h2v6h3l-4 4-4-4zm11-4h-4v1h4v8H1V3h4V2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1z"></path></svg></a>
</div>
<div class="file-navigation-option">
<a class="btn btn-sm" rel="nofollow" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"DOWNLOAD_ZIP","git_repository_type":"GIST","gist_id":43890587,"client_id":"725135939.1564074690","originating_request_id":"EF06:0C17:B04709:1675177:5DB14E19","originating_url":"https://gist.github.com/altendky/faf48446c335418dac8793635d119750","referrer":"https://github.com/sunu/qt5reactor/issues/12","user_id":61786}}" data-hydro-click-hmac="f4f024226497b7a0a1eeff89513a28cb5691a32941d3077ad9ed3cb6f851e0ca" data-ga-click="Gist, download zip, location:gist overview" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/archive/43023b73587f7608016ff11ac623cb677126052e.zip">Download ZIP</a>
</div>
</div>
</div>
</div>
</div>
<div class="container-lg px-3 new-discussion-timeline experiment-repo-nav">
<div class="repository-content gist-content">
<div>
<div class="js-gist-file-update-container js-task-list-container file-box">
<div id="file-qt5reactor_threads-py" class="file">
<div class="file-header">
<div class="file-actions">
<a class="btn btn-sm " href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/raw/43023b73587f7608016ff11ac623cb677126052e/qt5reactor_threads.py">Raw</a>
</div>
<div class="file-info">
<span class="icon">
<svg class="octicon octicon-gist" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.5 5L10 7.5 7.5 10l-.75-.75L8.5 7.5 6.75 5.75 7.5 5zm-3 0L2 7.5 4.5 10l.75-.75L3.5 7.5l1.75-1.75L4.5 5zM0 13V2c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v11c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1zm1 0h10V2H1v11z"></path></svg>
</span>
<a class="css-truncate" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750#file-qt5reactor_threads-py">
<strong class="user-select-contain gist-blob-name css-truncate-target">
qt5reactor_threads.py
</strong>
</a>
</div>
</div>
<div itemprop="text" class="Box-body p-0 blob-wrapper data type-python ">
<table class="highlight tab-size js-file-line-container" data-tab-size="8">
<tbody><tr>
<td id="file-qt5reactor_threads-py-L1" class="blob-num js-line-number" data-line-number="1"></td>
<td id="file-qt5reactor_threads-py-LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> qt5reactor</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L2" class="blob-num js-line-number" data-line-number="2"></td>
<td id="file-qt5reactor_threads-py-LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> sys</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L3" class="blob-num js-line-number" data-line-number="3"></td>
<td id="file-qt5reactor_threads-py-LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> time</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L4" class="blob-num js-line-number" data-line-number="4"></td>
<td id="file-qt5reactor_threads-py-LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L5" class="blob-num js-line-number" data-line-number="5"></td>
<td id="file-qt5reactor_threads-py-LC5" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L6" class="blob-num js-line-number" data-line-number="6"></td>
<td id="file-qt5reactor_threads-py-LC6" class="blob-code blob-code-inner js-file-line"><span class="pl-k">from</span> PyQt5 <span class="pl-k">import</span> QtCore</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L7" class="blob-num js-line-number" data-line-number="7"></td>
<td id="file-qt5reactor_threads-py-LC7" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L8" class="blob-num js-line-number" data-line-number="8"></td>
<td id="file-qt5reactor_threads-py-LC8" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L9" class="blob-num js-line-number" data-line-number="9"></td>
<td id="file-qt5reactor_threads-py-LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">thread</span>():</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L10" class="blob-num js-line-number" data-line-number="10"></td>
<td id="file-qt5reactor_threads-py-LC10" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L11" class="blob-num js-line-number" data-line-number="11"></td>
<td id="file-qt5reactor_threads-py-LC11" class="blob-code blob-code-inner js-file-line"> time.sleep(<span class="pl-c1">1</span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L12" class="blob-num js-line-number" data-line-number="12"></td>
<td id="file-qt5reactor_threads-py-LC12" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>done threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L13" class="blob-num js-line-number" data-line-number="13"></td>
<td id="file-qt5reactor_threads-py-LC13" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L14" class="blob-num js-line-number" data-line-number="14"></td>
<td id="file-qt5reactor_threads-py-LC14" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L15" class="blob-num js-line-number" data-line-number="15"></td>
<td id="file-qt5reactor_threads-py-LC15" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-c1">quit</span>():</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L16" class="blob-num js-line-number" data-line-number="16"></td>
<td id="file-qt5reactor_threads-py-LC16" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>quitting<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L17" class="blob-num js-line-number" data-line-number="17"></td>
<td id="file-qt5reactor_threads-py-LC17" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L18" class="blob-num js-line-number" data-line-number="18"></td>
<td id="file-qt5reactor_threads-py-LC18" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> <span class="pl-k">TODO</span>: _stopThreadPool() should not be necessary but otherwise</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L19" class="blob-num js-line-number" data-line-number="19"></td>
<td id="file-qt5reactor_threads-py-LC19" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> it hangs on quit. Killing results in:</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L20" class="blob-num js-line-number" data-line-number="20"></td>
<td id="file-qt5reactor_threads-py-LC20" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span></span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L21" class="blob-num js-line-number" data-line-number="21"></td>
<td id="file-qt5reactor_threads-py-LC21" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> Exception ignored in: <module 'threading' from '/usr/lib/python3.5/threading.py'></span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L22" class="blob-num js-line-number" data-line-number="22"></td>
<td id="file-qt5reactor_threads-py-LC22" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> Traceback (most recent call last):</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L23" class="blob-num js-line-number" data-line-number="23"></td>
<td id="file-qt5reactor_threads-py-LC23" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> File "/usr/lib/python3.5/threading.py", line 1288, in _shutdown</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L24" class="blob-num js-line-number" data-line-number="24"></td>
<td id="file-qt5reactor_threads-py-LC24" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> t.join()</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L25" class="blob-num js-line-number" data-line-number="25"></td>
<td id="file-qt5reactor_threads-py-LC25" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> File "/usr/lib/python3.5/threading.py", line 1054, in join</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L26" class="blob-num js-line-number" data-line-number="26"></td>
<td id="file-qt5reactor_threads-py-LC26" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> self._wait_for_tstate_lock()</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L27" class="blob-num js-line-number" data-line-number="27"></td>
<td id="file-qt5reactor_threads-py-LC27" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> File "/usr/lib/python3.5/threading.py", line 1070, in _wait_for_tstate_lock</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L28" class="blob-num js-line-number" data-line-number="28"></td>
<td id="file-qt5reactor_threads-py-LC28" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> elif lock.acquire(block, timeout):</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L29" class="blob-num js-line-number" data-line-number="29"></td>
<td id="file-qt5reactor_threads-py-LC29" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> KeyboardInterrupt</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L30" class="blob-num js-line-number" data-line-number="30"></td>
<td id="file-qt5reactor_threads-py-LC30" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L31" class="blob-num js-line-number" data-line-number="31"></td>
<td id="file-qt5reactor_threads-py-LC31" class="blob-code blob-code-inner js-file-line"> twisted.internet.reactor._stopThreadPool()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L32" class="blob-num js-line-number" data-line-number="32"></td>
<td id="file-qt5reactor_threads-py-LC32" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L33" class="blob-num js-line-number" data-line-number="33"></td>
<td id="file-qt5reactor_threads-py-LC33" class="blob-code blob-code-inner js-file-line"> app.quit()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L34" class="blob-num js-line-number" data-line-number="34"></td>
<td id="file-qt5reactor_threads-py-LC34" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>already quit<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L35" class="blob-num js-line-number" data-line-number="35"></td>
<td id="file-qt5reactor_threads-py-LC35" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L36" class="blob-num js-line-number" data-line-number="36"></td>
<td id="file-qt5reactor_threads-py-LC36" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L37" class="blob-num js-line-number" data-line-number="37"></td>
<td id="file-qt5reactor_threads-py-LC37" class="blob-code blob-code-inner js-file-line">app <span class="pl-k">=</span> QtCore.QCoreApplication(sys.argv)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L38" class="blob-num js-line-number" data-line-number="38"></td>
<td id="file-qt5reactor_threads-py-LC38" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L39" class="blob-num js-line-number" data-line-number="39"></td>
<td id="file-qt5reactor_threads-py-LC39" class="blob-code blob-code-inner js-file-line">qt5reactor.install()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L40" class="blob-num js-line-number" data-line-number="40"></td>
<td id="file-qt5reactor_threads-py-LC40" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L41" class="blob-num js-line-number" data-line-number="41"></td>
<td id="file-qt5reactor_threads-py-LC41" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">#</span> <span class="pl-k">TODO</span>: getThreadPool().start() should not be required but otherwise</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L42" class="blob-num js-line-number" data-line-number="42"></td>
<td id="file-qt5reactor_threads-py-LC42" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">#</span> it hangs without running thread()</span></td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L43" class="blob-num js-line-number" data-line-number="43"></td>
<td id="file-qt5reactor_threads-py-LC43" class="blob-code blob-code-inner js-file-line">twisted.internet.reactor.getThreadPool().start()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L44" class="blob-num js-line-number" data-line-number="44"></td>
<td id="file-qt5reactor_threads-py-LC44" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L45" class="blob-num js-line-number" data-line-number="45"></td>
<td id="file-qt5reactor_threads-py-LC45" class="blob-code blob-code-inner js-file-line">d <span class="pl-k">=</span> twisted.internet.threads.deferToThread(thread)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L46" class="blob-num js-line-number" data-line-number="46"></td>
<td id="file-qt5reactor_threads-py-LC46" class="blob-code blob-code-inner js-file-line">d.addCallback(<span class="pl-k">lambda</span> <span class="pl-smi">_</span>: <span class="pl-c1">quit</span>())</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L47" class="blob-num js-line-number" data-line-number="47"></td>
<td id="file-qt5reactor_threads-py-LC47" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads-py-L48" class="blob-num js-line-number" data-line-number="48"></td>
<td id="file-qt5reactor_threads-py-LC48" class="blob-code blob-code-inner js-file-line">sys.exit(app.exec())</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<div class="js-gist-file-update-container js-task-list-container file-box">
<div id="file-qt5reactor_threads_run-py" class="file">
<div class="file-header">
<div class="file-actions">
<a class="btn btn-sm " href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/raw/43023b73587f7608016ff11ac623cb677126052e/qt5reactor_threads_run.py">Raw</a>
</div>
<div class="file-info">
<span class="icon">
<svg class="octicon octicon-gist" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.5 5L10 7.5 7.5 10l-.75-.75L8.5 7.5 6.75 5.75 7.5 5zm-3 0L2 7.5 4.5 10l.75-.75L3.5 7.5l1.75-1.75L4.5 5zM0 13V2c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v11c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1zm1 0h10V2H1v11z"></path></svg>
</span>
<a class="css-truncate" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750#file-qt5reactor_threads_run-py">
<strong class="user-select-contain gist-blob-name css-truncate-target">
qt5reactor_threads_run.py
</strong>
</a>
</div>
</div>
<div itemprop="text" class="Box-body p-0 blob-wrapper data type-python ">
<table class="highlight tab-size js-file-line-container" data-tab-size="8">
<tbody><tr>
<td id="file-qt5reactor_threads_run-py-L1" class="blob-num js-line-number" data-line-number="1"></td>
<td id="file-qt5reactor_threads_run-py-LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> qt5reactor</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L2" class="blob-num js-line-number" data-line-number="2"></td>
<td id="file-qt5reactor_threads_run-py-LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> sys</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L3" class="blob-num js-line-number" data-line-number="3"></td>
<td id="file-qt5reactor_threads_run-py-LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> time</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L4" class="blob-num js-line-number" data-line-number="4"></td>
<td id="file-qt5reactor_threads_run-py-LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L5" class="blob-num js-line-number" data-line-number="5"></td>
<td id="file-qt5reactor_threads_run-py-LC5" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L6" class="blob-num js-line-number" data-line-number="6"></td>
<td id="file-qt5reactor_threads_run-py-LC6" class="blob-code blob-code-inner js-file-line"><span class="pl-k">from</span> PyQt5 <span class="pl-k">import</span> QtCore</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L7" class="blob-num js-line-number" data-line-number="7"></td>
<td id="file-qt5reactor_threads_run-py-LC7" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L8" class="blob-num js-line-number" data-line-number="8"></td>
<td id="file-qt5reactor_threads_run-py-LC8" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L9" class="blob-num js-line-number" data-line-number="9"></td>
<td id="file-qt5reactor_threads_run-py-LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">thread</span>():</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L10" class="blob-num js-line-number" data-line-number="10"></td>
<td id="file-qt5reactor_threads_run-py-LC10" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L11" class="blob-num js-line-number" data-line-number="11"></td>
<td id="file-qt5reactor_threads_run-py-LC11" class="blob-code blob-code-inner js-file-line"> time.sleep(<span class="pl-c1">1</span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L12" class="blob-num js-line-number" data-line-number="12"></td>
<td id="file-qt5reactor_threads_run-py-LC12" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>done threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L13" class="blob-num js-line-number" data-line-number="13"></td>
<td id="file-qt5reactor_threads_run-py-LC13" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L14" class="blob-num js-line-number" data-line-number="14"></td>
<td id="file-qt5reactor_threads_run-py-LC14" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L15" class="blob-num js-line-number" data-line-number="15"></td>
<td id="file-qt5reactor_threads_run-py-LC15" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-c1">quit</span>():</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L16" class="blob-num js-line-number" data-line-number="16"></td>
<td id="file-qt5reactor_threads_run-py-LC16" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>quitting<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L17" class="blob-num js-line-number" data-line-number="17"></td>
<td id="file-qt5reactor_threads_run-py-LC17" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L18" class="blob-num js-line-number" data-line-number="18"></td>
<td id="file-qt5reactor_threads_run-py-LC18" class="blob-code blob-code-inner js-file-line"> app.quit()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L19" class="blob-num js-line-number" data-line-number="19"></td>
<td id="file-qt5reactor_threads_run-py-LC19" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>already quit<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L20" class="blob-num js-line-number" data-line-number="20"></td>
<td id="file-qt5reactor_threads_run-py-LC20" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L21" class="blob-num js-line-number" data-line-number="21"></td>
<td id="file-qt5reactor_threads_run-py-LC21" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L22" class="blob-num js-line-number" data-line-number="22"></td>
<td id="file-qt5reactor_threads_run-py-LC22" class="blob-code blob-code-inner js-file-line">app <span class="pl-k">=</span> QtCore.QCoreApplication(sys.argv)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L23" class="blob-num js-line-number" data-line-number="23"></td>
<td id="file-qt5reactor_threads_run-py-LC23" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L24" class="blob-num js-line-number" data-line-number="24"></td>
<td id="file-qt5reactor_threads_run-py-LC24" class="blob-code blob-code-inner js-file-line">qt5reactor.install()</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L25" class="blob-num js-line-number" data-line-number="25"></td>
<td id="file-qt5reactor_threads_run-py-LC25" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L26" class="blob-num js-line-number" data-line-number="26"></td>
<td id="file-qt5reactor_threads_run-py-LC26" class="blob-code blob-code-inner js-file-line">d <span class="pl-k">=</span> twisted.internet.threads.deferToThread(thread)</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L27" class="blob-num js-line-number" data-line-number="27"></td>
<td id="file-qt5reactor_threads_run-py-LC27" class="blob-code blob-code-inner js-file-line">d.addCallback(<span class="pl-k">lambda</span> <span class="pl-smi">_</span>: <span class="pl-c1">quit</span>())</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L28" class="blob-num js-line-number" data-line-number="28"></td>
<td id="file-qt5reactor_threads_run-py-LC28" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L29" class="blob-num js-line-number" data-line-number="29"></td>
<td id="file-qt5reactor_threads_run-py-LC29" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted.internet</td>
</tr>
<tr>
<td id="file-qt5reactor_threads_run-py-L30" class="blob-num js-line-number" data-line-number="30"></td>
<td id="file-qt5reactor_threads_run-py-LC30" class="blob-code blob-code-inner js-file-line">sys.exit(twisted.internet.reactor.run())</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<div class="js-gist-file-update-container js-task-list-container file-box">
<div id="file-twisted_threads-py" class="file">
<div class="file-header">
<div class="file-actions">
<a class="btn btn-sm " href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/raw/43023b73587f7608016ff11ac623cb677126052e/twisted_threads.py">Raw</a>
</div>
<div class="file-info">
<span class="icon">
<svg class="octicon octicon-gist" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.5 5L10 7.5 7.5 10l-.75-.75L8.5 7.5 6.75 5.75 7.5 5zm-3 0L2 7.5 4.5 10l.75-.75L3.5 7.5l1.75-1.75L4.5 5zM0 13V2c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v11c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1zm1 0h10V2H1v11z"></path></svg>
</span>
<a class="css-truncate" href="https://gist.github.com/altendky/faf48446c335418dac8793635d119750#file-twisted_threads-py">
<strong class="user-select-contain gist-blob-name css-truncate-target">
twisted_threads.py
</strong>
</a>
</div>
</div>
<div itemprop="text" class="Box-body p-0 blob-wrapper data type-python ">
<table class="highlight tab-size js-file-line-container" data-tab-size="8">
<tbody><tr>
<td id="file-twisted_threads-py-L1" class="blob-num js-line-number" data-line-number="1"></td>
<td id="file-twisted_threads-py-LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> sys</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L2" class="blob-num js-line-number" data-line-number="2"></td>
<td id="file-twisted_threads-py-LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> time</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L3" class="blob-num js-line-number" data-line-number="3"></td>
<td id="file-twisted_threads-py-LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted.internet</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L4" class="blob-num js-line-number" data-line-number="4"></td>
<td id="file-twisted_threads-py-LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted.internet.reactor</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L5" class="blob-num js-line-number" data-line-number="5"></td>
<td id="file-twisted_threads-py-LC5" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> twisted.internet.threads</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L6" class="blob-num js-line-number" data-line-number="6"></td>
<td id="file-twisted_threads-py-LC6" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L7" class="blob-num js-line-number" data-line-number="7"></td>
<td id="file-twisted_threads-py-LC7" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L8" class="blob-num js-line-number" data-line-number="8"></td>
<td id="file-twisted_threads-py-LC8" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">thread</span>():</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L9" class="blob-num js-line-number" data-line-number="9"></td>
<td id="file-twisted_threads-py-LC9" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L10" class="blob-num js-line-number" data-line-number="10"></td>
<td id="file-twisted_threads-py-LC10" class="blob-code blob-code-inner js-file-line"> time.sleep(<span class="pl-c1">1</span>)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L11" class="blob-num js-line-number" data-line-number="11"></td>
<td id="file-twisted_threads-py-LC11" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>done threading<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L12" class="blob-num js-line-number" data-line-number="12"></td>
<td id="file-twisted_threads-py-LC12" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L13" class="blob-num js-line-number" data-line-number="13"></td>
<td id="file-twisted_threads-py-LC13" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L14" class="blob-num js-line-number" data-line-number="14"></td>
<td id="file-twisted_threads-py-LC14" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-c1">quit</span>():</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L15" class="blob-num js-line-number" data-line-number="15"></td>
<td id="file-twisted_threads-py-LC15" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>quitting<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L16" class="blob-num js-line-number" data-line-number="16"></td>
<td id="file-twisted_threads-py-LC16" class="blob-code blob-code-inner js-file-line"> twisted.internet.reactor.stop()</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L17" class="blob-num js-line-number" data-line-number="17"></td>
<td id="file-twisted_threads-py-LC17" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(<span class="pl-s"><span class="pl-pds">'</span>already quit<span class="pl-pds">'</span></span>)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L18" class="blob-num js-line-number" data-line-number="18"></td>
<td id="file-twisted_threads-py-LC18" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L19" class="blob-num js-line-number" data-line-number="19"></td>
<td id="file-twisted_threads-py-LC19" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L20" class="blob-num js-line-number" data-line-number="20"></td>
<td id="file-twisted_threads-py-LC20" class="blob-code blob-code-inner js-file-line">d <span class="pl-k">=</span> twisted.internet.threads.deferToThread(thread)</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L21" class="blob-num js-line-number" data-line-number="21"></td>
<td id="file-twisted_threads-py-LC21" class="blob-code blob-code-inner js-file-line">d.addCallback(<span class="pl-k">lambda</span> <span class="pl-smi">_</span>: <span class="pl-c1">quit</span>())</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L22" class="blob-num js-line-number" data-line-number="22"></td>
<td id="file-twisted_threads-py-LC22" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="file-twisted_threads-py-L23" class="blob-num js-line-number" data-line-number="23"></td>
<td id="file-twisted_threads-py-LC23" class="blob-code blob-code-inner js-file-line">sys.exit(twisted.internet.reactor.run())</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<a name="comments"></a>
<div class="js-quote-selection-container" data-quote-markdown=".js-comment-body">
<div class="js-discussion js-socket-channel" data-channel="marked-as-read:gist:43890587">
<div class="ml-6 pl-3">
<!-- Rendered timeline since 2017-05-18 14:09:04 -->
<div id="partial-timeline-marker" class="js-timeline-marker js-updatable-content" data-url="/altendky/faf48446c335418dac8793635d119750/show_partial?partial=gist%2Ftimeline_marker&since=1495141744" data-last-modified="Thu, 18 May 2017 21:09:04 GMT">
</div>
</div>
<div class="discussion-timeline-actions">
<div class="timeline-comment-wrapper timeline-new-comment js-comment-container width-fit">
<span class="timeline-comment-avatar "><a class="d-inline-block" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=61786" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://gist.github.com/inhahe"><img class="avatar" src="./qt5reactor_threads.py_files/61786(1)" width="40" height="40" alt="@inhahe"></a></span>
<!-- '"` --><!-- </textarea></xmp> --><form class="js-new-comment-form js-needs-timeline-marker-header" action="https://gist.github.com/altendky/faf48446c335418dac8793635d119750/comments" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="Lsg7Dh5LWHRhOHQNCsfajw0cp+0T6cwPGiAymlG7D7A+ZTZyikPSMXRYCNOaD0xglYy9oSdMsomnnqlrP4BYDA==">
<div class="timeline-comment">
<tab-container class="js-previewable-comment-form previewable-comment-form write-selected" data-preview-url="/preview?markdown_unsupported=false&subject=faf48446c335418dac8793635d119750&subject_type=Gist" data-preview-authenticity-token="68oeVVE4HaFCIxNnHWG0lxfRvkRo9iZfgYIIAz0VD3RT1xoVeP2Rxi0Y5nGUCkv8hQWU4Jb559QewpPp+bztxw==">
<div class="comment-form-head tabnav d-flex flex-justify-between mb-2 ">
<div class="tabnav-tabs " role="tablist">
<button type="button" class="btn-link tabnav-tab write-tab js-write-tab " role="tab" aria-selected="true">Write</button>
<button type="button" class="btn-link tabnav-tab preview-tab js-preview-tab " role="tab">Preview</button>
</div>
<markdown-toolbar for="new_comment_field" class="js-details-container Details toolbar-commenting d-flex no-wrap flex-items-start flex-wrap px-2 ">
<div class="flex-nowrap d-inline-block mr-3">
<md-header tabindex="-1" class="toolbar-item tooltipped tooltipped-n mx-1" aria-label="Add header text" data-ga-click="Markdown Toolbar, click, header" role="button">
<svg class="octicon octicon-text-size" viewBox="0 0 18 16" version="1.1" width="18" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M13.62 9.08L12.1 3.66h-.06l-1.5 5.42h3.08zM5.7 10.13S4.68 6.52 4.53 6.02h-.08l-1.13 4.11H5.7zM17.31 14h-2.25l-.95-3.25h-4.07L9.09 14H6.84l-.69-2.33H2.87L2.17 14H0l3.3-9.59h2.5l2.17 6.34L10.86 2h2.52l3.94 12h-.01z"></path></svg>
</md-header>
<md-bold tabindex="-1" class="toolbar-item tooltipped tooltipped-n mx-1" aria-label="Add bold text <ctrl+b>" data-ga-click="Markdown Toolbar, click, bold" role="button" hotkey="b">
<svg class="octicon octicon-bold" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1 2h3.83c2.48 0 4.3.75 4.3 2.95 0 1.14-.63 2.23-1.67 2.61v.06c1.33.3 2.3 1.23 2.3 2.86 0 2.39-1.97 3.52-4.61 3.52H1V2zm3.66 4.95c1.67 0 2.38-.66 2.38-1.69 0-1.17-.78-1.61-2.34-1.61H3.13v3.3h1.53zm.27 5.39c1.77 0 2.75-.64 2.75-1.98 0-1.27-.95-1.81-2.75-1.81h-1.8v3.8h1.8v-.01z"></path></svg>
</md-bold>
<md-italic tabindex="-1" class="toolbar-item tooltipped tooltipped-n mx-1" aria-label="Add italic text <ctrl+i>" data-ga-click="Markdown Toolbar, click, italic" role="button" hotkey="i">
<svg class="octicon octicon-italic" viewBox="0 0 6 16" version="1.1" width="6" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M2.81 5h1.98L3 14H1l1.81-9zm.36-2.7c0-.7.58-1.3 1.33-1.3.56 0 1.13.38 1.13 1.03 0 .75-.59 1.3-1.33 1.3-.58 0-1.13-.38-1.13-1.03z"></path></svg>
</md-italic>
</div>
<div class="d-inline-block mr-3">
<md-quote tabindex="-1" class="toolbar-item tooltipped tooltipped-n p-1 mx-1" aria-label="Insert a quote" data-ga-click="Markdown Toolbar, click, quote" role="button">
<svg class="octicon octicon-quote" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M6.16 3.5C3.73 5.06 2.55 6.67 2.55 9.36c.16-.05.3-.05.44-.05 1.27 0 2.5.86 2.5 2.41 0 1.61-1.03 2.61-2.5 2.61-1.9 0-2.99-1.52-2.99-4.25 0-3.8 1.75-6.53 5.02-8.42L6.16 3.5zm7 0c-2.43 1.56-3.61 3.17-3.61 5.86.16-.05.3-.05.44-.05 1.27 0 2.5.86 2.5 2.41 0 1.61-1.03 2.61-2.5 2.61-1.89 0-2.98-1.52-2.98-4.25 0-3.8 1.75-6.53 5.02-8.42l1.14 1.84h-.01z"></path></svg>
</md-quote>
<md-code tabindex="-1" class="toolbar-item tooltipped tooltipped-n p-1 mx-1" aria-label="Insert code" data-ga-click="Markdown Toolbar, click, code" role="button">
<svg class="octicon octicon-code" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
</md-code>
<md-link tabindex="-1" class="toolbar-item tooltipped tooltipped-n p-1 d-inline-block mx-1" aria-label="Add a link <ctrl+k>" data-ga-click="Markdown Toolbar, click, link" role="button" hotkey="k">
<svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>
</md-link>
</div>
<div class="d-inline-block mr-3">
<md-unordered-list tabindex="-1" class="toolbar-item tooltipped tooltipped-n mx-1" aria-label="Add a bulleted list" data-ga-click="Markdown Toolbar, click, unordered list" role="button">
<svg class="octicon octicon-list-unordered" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M2 13c0 .59 0 1-.59 1H.59C0 14 0 13.59 0 13c0-.59 0-1 .59-1h.81c.59 0 .59.41.59 1H2zm2.59-9h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1H4.59C4 2 4 2.41 4 3c0 .59 0 1 .59 1zM1.41 7H.59C0 7 0 7.41 0 8c0 .59 0 1 .59 1h.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm0-5H.59C0 2 0 2.41 0 3c0 .59 0 1 .59 1h.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm10 5H4.59C4 7 4 7.41 4 8c0 .59 0 1 .59 1h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01zm0 5H4.59C4 12 4 12.41 4 13c0 .59 0 1 .59 1h6.81c.59 0 .59-.41.59-1 0-.59 0-1-.59-1h.01z"></path></svg>
</md-unordered-list>