   ///
   /// When called on a PromiseSource that is already Resolved or Rejected, the call is ignored.
   public func reject(_ error: Error) {
-
     resolveResult(.error(error))
   }
 
   internal func resolveResult(_ result: Result<Value, Error>) {
+    lock.lock(); defer { lock.unlock() }
 
     switch state {
     case .unresolved:
       state = result.state
 
-      executeResultHandlers(result)
+      // Call all previously scheduled handlers
+      callHandlers(result, handlers: handlers, dispatchKey: dispatchKey, dispatchMethod: dispatchMethod)
+
+      // Cleanup
+      handlers = []
     default:
       break
     }
   }
 
-  private func executeResultHandlers(_ result: Result<Value, Error>) {
-
-    // Call all previously scheduled handlers
-    callHandlers(result, handlers: handlers, dispatchKey: dispatchKey, dispatchMethod: dispatchMethod)
-
-    // Cleanup
-    handlers = []
-  }
-
   // MARK: Adding result handlers
 
   internal func addOrCallResultHandler(_ handler: @escaping (Result<Value, Error>) -> Void) {
+    lock.lock(); defer { lock.unlock() }
 
     switch state {
     case .unresolved:

public class PromiseSource<Value, Error> {
  typealias ResultHandler = (Result<Value, Error>) -> Void

  private var handlers: [(Result<Value, Error>) -> Void] = []
  internal let dispatchKey: DispatchSpecificKey<Void>
  internal let dispatchMethod: DispatchMethod

  ///
  /// When called on a PromiseSource that is already Resolved or Rejected, the call is ignored.
  public func resolve(_ value: Value) {
    resolveResult(.value(value))
  }

