     
     /// Result of task.
     public final var result: Result {
-        if !completed {
-            dispatch_semaphore_wait(self.sem, DISPATCH_TIME_FOREVER)
-            defer { dispatch_semaphore_signal(self.sem) }
-        }
+        dispatch_once(&token) { self.block(self) }
         return self._result!
     }
 }

                _self._notify = []
            } else {
                let result = block()
                _self._lck.synchronized { _self._result = result }
                dispatch_semaphore_signal(_self.sem)
                _self.signal()
            }
        }


public class SDTask<Result> : SDAtomic {
    
    private var _notify: [(Result) -> Void] = []
    
    private var _lck: SDSpinLock = SDSpinLock()
    
    private var token: dispatch_once_t = 0
    private var _result: Result?
    
    private init(queue: dispatch_queue_t, suspend: ((Result) -> Bool)?, block: () -> Result) {
