         }
     }
     
+    //  MARK: - Delegate
+    
+    public func addDelegate(_ delegate: MXThreadingServiceDelegate) {
+        multicastDelegate.addDelegate(delegate)
+    }
+    
+    public func removeDelegate(_ delegate: MXThreadingServiceDelegate) {
+        multicastDelegate.removeDelegate(delegate)
+    }
+    
+    public func removeAllDelegates() {
+        multicastDelegate.removeAllDelegates()
+    }
+    
+    private func notifyDidUpdateThreads() {
+        multicastDelegate.invoke({ $0.threadingServiceDidUpdateThreads(self) })
+    }
+    
 }

    }
}

@objcMembers
public class MXThreadingService: NSObject {
    
    private weak var session: MXSession?
    
    private var threads: [String: MXThread] = [:]
    
    public static let newThreadCreated: Notification.Name = Notification.Name("MXThreadingService.newThreadCreated")
    

        if let thread = thread(withId: threadIdentifier) {
            //  add event to the thread if found
            thread.addEvent(event)
            notifyDidUpdateThreads()
        } else {
            //  create the thread for the first time
            let thread: MXThread
