Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

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.4 Sekunden  ¤

*© 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1104845
#Domains=499267