mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
New way for subscribe/notify async about any events.
Two classes base::Observable<Event> and base::Subscriber were added. base::Observable<Event> can notify about Event-s, while any base::Subscriber can subscribe and then async receive them.
This commit is contained in:
@@ -275,16 +275,16 @@ public:
|
||||
SingleDelayedCall(QObject *parent, const char *member) : QObject(parent), _member(member) {
|
||||
}
|
||||
void call() {
|
||||
if (!_pending.loadAcquire()) {
|
||||
_pending.storeRelease(1);
|
||||
if (_pending.testAndSetOrdered(0, 1)) {
|
||||
QMetaObject::invokeMethod(this, "makeDelayedCall", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
private slots:
|
||||
void makeDelayedCall() {
|
||||
_pending.storeRelease(0);
|
||||
QMetaObject::invokeMethod(parent(), _member);
|
||||
if (_pending.testAndSetOrdered(1, 0)) {
|
||||
QMetaObject::invokeMethod(parent(), _member);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user