     - parameter object: Sender to remove from the dispatch table. Specify a notification sender to remove only entries that specify this sender. When nil, the receiver does not use notification senders as criteria for removal.
     */
     public func unobserve(name: String?, object: NSObject? = nil) {
-        OSSpinLockLock(&lock)
         
-        let filterBlock = { [unowned self] (info: NotificationInfo) -> Bool in
-            if info.name == name && info.object == object {
-                self.DefaultCenter.removeObserver(info.observer, name: info.name, object: info.object)
-                return false
+        lockWith {
+            let filterBlock = { [unowned self] (info: NotificationInfo) -> Bool in
+                if info.name == name && info.object == object {
+                    self.DefaultCenter.removeObserver(info.observer, name: info.name, object: info.object)
+                    return false
+                }
+                return true
             }
-            return true
+            
+            let filteredBlockInfos = self.blockInfos.filter(filterBlock)
+            blockInfos = Set<NotificationInfo>(filteredBlockInfos)
+            
+            let filteredSelectorInfos = self.selectorInfos.filter(filterBlock)
+            selectorInfos = Set<NotificationInfo>(filteredSelectorInfos)
         }
-        
-        let filteredBlockInfos = self.blockInfos.filter(filterBlock)
-        blockInfos = Set<NotificationInfo>(filteredBlockInfos)
-        
-        let filteredSelectorInfos = self.selectorInfos.filter(filterBlock)
-        selectorInfos = Set<NotificationInfo>(filteredSelectorInfos)
-        
-        OSSpinLockUnlock(&lock)
-        
     }
     
     /**

    }
}

/// The notification handler response for handing all the hard work of observe and unoberve notifications.
/// The basic usage is rather similar to the official `NSNotification Center`
public class NotificationHandler: NSObject {
    public typealias NotificationClosure = (NSNotification!) -> Void
    
    private weak var observer: NSObject!
    private var blockInfos = Set<NotificationInfo>()
    private var selectorInfos = Set<NotificationInfo>()
    private var lock = OS_SPINLOCK_INIT
    
    private var DefaultCenter: NSNotificationCenter {
        return NSNotificationCenter.defaultCenter()

    // MARK: Initialization
    
    /**
    Create a notification handler instance using the observer. Observer is responded for hold that instance. Normally, you don't need to call this method manually.
    
    - parameter observer: The observer will be weak referenced by that instance.
    
    - returns: An initialized instance
    */
    init (observer: NSObject) {
        pthread_mutex_init(&lock, nil)
        self.observer = observer
    }
    
