Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/Threema/RootCoordinator/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 963 B image not shown  

Quelle  DeferredDispatcher.swift   Sprache: JAVA

 

/// Buffers callbacks for a not-yet-available handler, then replays them in receipt order
/// once a handler is attached.
@MainActor
final class DeferredDispatcher<Handler: AnyObject> {

    private weak var target: Handler?
    private var pending: [(Handler) -> Void] = []

    /// Install the real handler and drain queued calls in receipt order.
    /// Calling twice replaces the target; the queue is drained against the new target.
    func attach(_ handler: Handler) {
        target = handler
        let queued = pending
        pending.removeAll()
        for forward in queued {
            forward(handler)
        }
    }

    func detach() {
        target = nil
    }

    /// Forward immediately if attached, otherwise queue until the next ``attach(_:)``.
    func dispatch(_ forward: @escaping (Handler) -> Void) {
        if let target {
            forward(target)
        }
        else {
            pending.append(forward)
        }
    }
}

Messung
CHZG
829610092

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.