     */
     public static func unregister(key: Any) -> Bool {
         if let key = key as? Key {
-            return dependencies.removeValueForKey(key) != nil
+            var unregistered: Bool = false
+            dispatch_barrier_sync(queue) {
+                unregistered = dependencies.removeValueForKey(key) != nil
+            }
+            return unregistered
         }
         return false
     }

     Clears all dependencies from Guise.
    */
    public static func reset() {
        dependencies = [:]
    }
    
    /**
     Clears all dependencies in the given container from Guise.
    */
    public static func reset(container: String?) {
        for key in dependencies.keys {
            if key.container == container {
                dependencies.removeValueForKey(key)
            }
        }
    }

    }
    
    private static var dependencies = [Key: Dependency]()
    private static let queue = dispatch_queue_create(nil, DISPATCH_QUEUE_CONCURRENT)
    
    private init() {}
    
