no message

This commit is contained in:
Peter 2017-11-14 20:40:02 +03:00
parent 7d1ae890a0
commit f9905d961d

View File

@ -100,11 +100,18 @@ public final class Subscriber<T, E> {
var disposeDisposable: Disposable? = nil
var next: ((T) -> Void)?
var error: ((E) -> Void)?
var completed: (() -> Void)?
pthread_mutex_lock(&self.lock)
if !self.terminated {
action = self.completed
next = self.next
self.next = nil
error = self.error
self.error = nil
completed = self.completed
self.completed = nil
self.terminated = true
@ -113,6 +120,16 @@ public final class Subscriber<T, E> {
}
pthread_mutex_unlock(&self.lock)
if let next = next {
withExtendedLifetime(next, {})
}
if let error = error {
withExtendedLifetime(error, {})
}
if let completed = completed {
withExtendedLifetime(completed, {})
}
if action != nil {
action()
}