Просмотр исходного кода

Add comment to dispatch helper

onevcat 10 лет назад
Родитель
Сommit
9a094f31bc
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      Sources/ThreadHelper.swift

+ 3 - 0
Sources/ThreadHelper.swift

@@ -30,6 +30,9 @@ func dispatch_async_safely_to_main_queue(block: ()->()) {
     dispatch_async_safely_to_queue(dispatch_get_main_queue(), block)
 }
 
+// This methd will dispatch the `block` to a specified `queue`.
+// If the `queue` is the main queue, and current thread is main thread, the block 
+// will be invoked immediately instead of being dispatched.
 func dispatch_async_safely_to_queue(queue: dispatch_queue_t, _ block: ()->()) {
     if queue === dispatch_get_main_queue() && NSThread.isMainThread() {
         block()