Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/sgotti/oncemultitimer

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sgotti/oncemultitimer

  • v0.1.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

OnceMultiTimer

GoDoc Build Status

OnceMultiTimer is a timer that can be scheduled multiple times but will fire only once when the first timer expires.

Documentation

See the godoc package documentation.

Getting Started

Install oncemultitimer in the usual way:

go get github.com/sgotti/oncemultitimer

Example program:

package main

import (
	"log"
	"time"

	"github.com/sgotti/oncemultitimer"
)

func main() {
	log.Printf("start")
	t := oncemultitimer.NewTimer()

	// schedule multiple timers with different durations
	t.AddTimer(3 * time.Second)
	t.AddTimer(2 * time.Second)
	t.AddTimer(1 * time.Second)

	<-t.C

	// timer will expire after 1 second (the lowest timer duration)
	log.Printf("timer expired")
}

FAQs

Package last updated on 07 Aug 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc