      Clears all dependencies from Guise.
     */
     public static func reset() {
-        dependencies = [:]
+        dispatch_barrier_async(queue) {
+            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)
+        dispatch_barrier_async(queue) {
+            for key in dependencies.keys {
+                if key.container == container {
+                    dependencies.removeValueForKey(key)
+                }
             }
         }
     }

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

     */
    public static func register<P, D>(type type: String = String(reflecting: D.self), name: String? = nil, container: String? = nil, lifecycle: Lifecycle = .NotCached, eval: P -> D) -> Any {
        let key = Key(type: type, name: name, container: container)
        dispatch_barrier_async(queue) {
            dependencies[key] = Dependency(lifecycle: lifecycle, eval: eval)
        }
        return key
    }
    
