Squid Web Cache master
Loading...
Searching...
No Matches
Asynchronous Calls
Collaboration diagram for Asynchronous Calls:

Terminology

Typical life cycle

  1. Creator creates a Call object and stores its pointer, possibly in a temporary variable. If Creator is the future Recipient of the Call, it is customary to talk about a "callback". In such context, Creator gives the Call pointer to some other code (the future Caller). Calls are refcounted and the AsyncCall::Pointer class must be used to point and share them.
  2. Time passes and something triggers the need to dial the call.
  3. Caller schedules (a.k.a, places) the Call. The Call is placed in the AsyncCallQueue. The queue preserves the scheduling call order.
  4. Time passes and it is now time to dial the call.
  5. AsyncCallQueue checks whether the call can be dialed. If yes, AsyncCallQueue dials the Call and the Recipient receives it. Otherwise, only a debugging message is logged (if enabled). Dialing a call involves several state checks at several stages, depending on the Call type.
  6. The Call is alive while the Recipient is handling it. That state ends when the Recipient code (a.k.a., handler) returns. At that point, the AsyncCallQueue proceeds to handle other calls.
  7. The Call object is destroyed when the last reference to it is gone. One should not try to invalidate or delete the call.

Basic rules

Call Canceling