     public func signal() -> Int {
         lock.lock()
         value += 1
-        let signal:AnyContainer<SafeTask>? = signals.isEmpty ? nil : signals.removeFirst()
+        let signal:SafeTask? = signals.isEmpty ? nil : signals.removeLast()
         lock.unlock()
-        signal?.content()
+        signal?()
         return 1
     }
 }

private enum Wakeable {
    case Loop(loop:RunnableRunLoopType)
    case Sema(sema:SemaphoreType)
}

private extension Wakeable {

        self.value = value
        signals = Array()
        lock = NSLock()
        signaled = try! ThreadLocal()
    }
    
    //TODO: optimise with atomics for value. Will allow to run non-blocked sema faster
