src/threadButler/events

Source   Edit  

Defines the Events that should happen when starting a thread-server or when shutting it down Premade Events

Types

AsyncEvent = proc (): Future[void] {.closure, ...gcsafe.}
Source   Edit  
Event = object
  case async*: bool
  of true:
      asyncHandler*: AsyncEvent

  of false:
      syncHandler*: SyncEvent

  
startup or shutdown event which is executed once. Source   Edit  
SyncEvent = proc () {.closure, ...gcsafe.}
Source   Edit  

Procs

proc exec(event: Event) {.inline, ...raises: [ValueError, Exception, OSError],
                          tags: [TimeEffect, RootEffect], forbids: [].}
Executes a single event Source   Edit  
proc execEvents(events: seq[Event]) {....raises: [ValueError, Exception, OSError],
                                      tags: [TimeEffect, RootEffect],
                                      forbids: [].}
Executes a list of events Source   Edit  
func initEvent(handler: AsyncEvent): Event {....raises: [], tags: [], forbids: [].}
Initializes a new asynchronous event. Source   Edit  
func initEvent(handler: SyncEvent): Event {....raises: [], tags: [], forbids: [].}
Initializes a new synchronous event. Source   Edit  

Templates

template initCreateTaskpoolEvent(size: int; taskPoolVar: untyped): Event
Convenience Utility for status/nim-taskpools. Creates an Event that creates/initializes the threadpool in the variable contained in taskPoolVar. Source   Edit  
template initDestroyTaskpoolEvent(taskPoolVar: untyped): Event
Convenience Utility for status/nim-taskpools. Creates an Event that destroys the threadpool in the variable contained in taskPoolVar. Source   Edit