 fileprivate extension Swen where EventType: StickyEvent {
 
     func register(_ observer: AnyObject, onQueue queue: OperationQueue, handler: @escaping EventListenerClosure) {
-        _ = editListenersSemaphore.wait(timeout: DispatchTime.distantFuture)
-        defer { editListenersSemaphore.signal() }
+        editListenersMutex.wait()
+        defer { editListenersMutex.signal() }
 
         let listener = EventListener<EventType>(observer, queue, handler)
         listeners.append(listener)
         if let sticky = sticky {
             listener.queue.addOperation { [weak listener] in
-                listener?.post(sticky)
+                listener?.post(sticky, async: false)
             }
         }
     }
 
     func post(_ event: EventType) {
-        _ = stickySemaphore.wait(timeout: DispatchTime.distantFuture)
+        stickyMutex.wait()
+        defer { stickyMutex.signal() }
         sticky = event
-        stickySemaphore.signal()
-
         postToAll(event)
     }
 

internal extension Swen {

    static func instance(in storage: SwenStorage) -> Swen<EventType> {
        _ = storage.instanceSemaphore.wait(timeout: DispatchTime.distantFuture)
        defer { storage.instanceSemaphore.signal() }

        for case let bus as Swen<EventType> in storage.buses {
            return bus

    }

    func postToAll(_ event: EventType) {
        editListenersMutex.wait()
        defer { editListenersMutex.signal() }
        listeners.forEach { $0.post(event, async: editListenersMutex.value <= 0) }
    }

    func unregister(_ observer: AnyObject) {
        editListenersMutex.wait()
        defer { editListenersMutex.signal() }
        let pointer = UnsafeRawPointer(Unmanaged.passUnretained(observer).toOpaque())
        listeners = listeners.filter { $0.observerPointer != pointer }
    }

}
