eventqueue

  Source   Edit

Types

Cont = ref object of Continuation
  when eqDebug:
      clock: Clock           ## time of latest poll loop
      delay: Duration        ## polling overhead
      id: Id                 ## our last registration
      fd: Fd                 ## our last file-descriptor
    
  when cpsTrace:
      filename: string
      line: int
      column: int
      identity: string

  
  Source   Edit

Procs

proc coop() {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc coop(c: Cont): Cont {....raises: [], tags: [TimeEffect].}
Pass control to other pending continuations in the dispatcher before continuing; effectively a cooperative yield.   Source   Edit
proc dismiss() {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc dismiss(c: Cont): Cont {....raises: [], tags: [].}
Discard the current continuation.   Source   Edit
proc fork() {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc fork(c: Cont): Cont {....raises: [], tags: [TimeEffect].}
Duplicate the current continuation.   Source   Edit
proc init(c: Cont): Cont {....raises: [], tags: [].}
  Source   Edit
proc iowait(c: Cont; file: int | SocketHandle; events: set[Event]): Cont
Continue upon any of events on the given file-descriptor or SocketHandle.   Source   Edit
proc iowait(file: int | SocketHandle; events: set[Event]) {.cpsMustJump,
    cpsMagicCall.}
  Source   Edit
proc jield() {....deprecated: "renamed to coop()", cpsMustJump, cpsMagicCall,
               ...raises: [], tags: [].}
Deprecated: renamed to coop()
  Source   Edit
proc jield(c: Cont): Cont {....deprecated: "renamed to coop()", raises: [],
                            tags: [TimeEffect].}
Deprecated: renamed to coop()
  Source   Edit
proc len(eq: EventQueue): int {....raises: [], tags: [].}
The number of pending continuations.   Source   Edit
proc newSemaphore(): Semaphore {....raises: [], tags: [TimeEffect].}
Create a new Semaphore.   Source   Edit
proc noop() {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc noop(c: Cont): Cont {....raises: [], tags: [].}
A primitive that merely sheds scope.   Source   Edit
proc poll() {....raises: [Exception, KeyError, OSError],
              tags: [RootEffect, TimeEffect].}
See what continuations need running and run them.   Source   Edit
proc run(interval: Duration = DurationZero) {.
    ...raises: [Exception, KeyError, OSError], tags: [TimeEffect, RootEffect].}
The dispatcher runs with a maximal polling interval; an interval of DurationZero causes the dispatcher to return when the queue is empty.   Source   Edit
proc signal(s: var Semaphore) {....raises: [], tags: [TimeEffect].}
Signal the given Semaphore s, causing the first waiting continuation to be queued for execution in the dispatcher; control remains in the calling procedure.   Source   Edit
proc signalAll(s: var Semaphore) {....raises: [], tags: [TimeEffect].}
Signal the given Semaphore s, causing all waiting continuations to be queued for execution in the dispatcher; control remains in the calling procedure.   Source   Edit
proc sleep(c: Cont; interval: Duration): Cont {....raises: [ValueError],
    tags: [TimeEffect].}
Sleep for interval before continuing.   Source   Edit
proc sleep(c: Cont; ms: int): Cont {....raises: [ValueError], tags: [TimeEffect].}
Sleep for ms milliseconds before continuing.   Source   Edit
proc sleep(c: Cont; secs: float): Cont {....raises: [ValueError],
    tags: [TimeEffect].}
Sleep for secs seconds before continuing.   Source   Edit
proc sleep(interval: Duration) {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc sleep(ms: int) {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc sleep(secs: float) {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc spawn(c: Cont) {....raises: [], tags: [TimeEffect].}
Queue the supplied continuation c; control remains in the calling procedure.   Source   Edit
proc stop() {....raises: [], tags: [TimeEffect].}
Tell the dispatcher to stop, discarding all pending continuations.   Source   Edit
proc trampoline(c: Cont) {....raises: [Exception], tags: [RootEffect].}
Run the supplied continuation until it is complete.   Source   Edit
proc wait(c: Cont; s: var Semaphore): Cont {....raises: [], tags: [TimeEffect].}
Queue the current continuation pending readiness of the given Semaphore s.   Source   Edit
proc wait(s: var Semaphore) {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit