質問編集履歴

1

試したコードを追記致しました。

2017/07/11 14:17

投稿

street
street

スコア34

test CHANGED
File without changes
test CHANGED
@@ -82,7 +82,31 @@
82
82
 
83
83
  ###試したこと
84
84
 
85
- DispatchQueue.global().async等を使ってみましたが同様に処理全体がロックしました。
85
+ DispatchQueue.global().async使って以下のように組んでみましたが同様に処理全体がロックしました。
86
+
87
+
88
+
89
+ var timer = Timer()
90
+
91
+
92
+
93
+ // スレッド生成
94
+
95
+ DispatchQueue.global().async{
96
+
97
+ // タイマー生成
98
+
99
+ timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.countDown), userInfo: nil, repeats: true)
100
+
101
+ }
102
+
103
+ debugPrint("メインスレッド停止")
104
+
105
+ semaphoreCountDown.wait()
106
+
107
+ debugPrint("メインスレッド再開")
108
+
109
+
86
110
 
87
111
 
88
112