mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
no message
This commit is contained in:
parent
7d1ae890a0
commit
f9905d961d
@ -100,11 +100,18 @@ public final class Subscriber<T, E> {
|
|||||||
|
|
||||||
var disposeDisposable: Disposable? = nil
|
var disposeDisposable: Disposable? = nil
|
||||||
|
|
||||||
|
var next: ((T) -> Void)?
|
||||||
|
var error: ((E) -> Void)?
|
||||||
|
var completed: (() -> Void)?
|
||||||
|
|
||||||
pthread_mutex_lock(&self.lock)
|
pthread_mutex_lock(&self.lock)
|
||||||
if !self.terminated {
|
if !self.terminated {
|
||||||
action = self.completed
|
action = self.completed
|
||||||
|
next = self.next
|
||||||
self.next = nil
|
self.next = nil
|
||||||
|
error = self.error
|
||||||
self.error = nil
|
self.error = nil
|
||||||
|
completed = self.completed
|
||||||
self.completed = nil
|
self.completed = nil
|
||||||
self.terminated = true
|
self.terminated = true
|
||||||
|
|
||||||
@ -113,6 +120,16 @@ public final class Subscriber<T, E> {
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&self.lock)
|
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 {
|
if action != nil {
|
||||||
action()
|
action()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user