Browse Source

Add comment to dispatch helper

onevcat 10 years ago
parent
commit
9a094f31bc
1 changed files with 3 additions and 0 deletions
  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)
     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: ()->()) {
 func dispatch_async_safely_to_queue(queue: dispatch_queue_t, _ block: ()->()) {
     if queue === dispatch_get_main_queue() && NSThread.isMainThread() {
     if queue === dispatch_get_main_queue() && NSThread.isMainThread() {
         block()
         block()