🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

gopkg.in/ryankurte/go-async-mgr.v1

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gopkg.in/ryankurte/go-async-mgr.v1

v1.0.0
Go
Version published
Created
Source

go-async-mgr

Documentation GitHub tag Build Status

A quick and dirty wrapper for managing communication between parallel asynchronous services.

Usage



import(
    "gopkg.in/ryankurte/go-async-mgr.v1"
)

// Create a service manager
// This requires that you specify the global input channel size
sm := async.NewServiceManager(32)

// Create async service instances around RunnableInterfaces
// Again, this requires that you specify the per-service input channel size
s1 := async.NewAsyncService(&FakeWorker{id: 1}, 2)
s2 := async.NewAsyncService(&FakeWorker{id: 2}, 2)

// Bind the services into the manager
sm.BindService(&s1)
sm.BindService(&s2)

// Run the service manager
// This launches all worker threads automatically
sm.Run()

// Send some events to the service manager
// These will be distributed to all workers (in parallel)
sm.SendEvent("test")

...

// Shut down the service manager
// This will wait and exit all async services
sm.Exit()

FAQs

Package last updated on 15 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts