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

posixtimer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posixtimer

  • 0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

posixtimer v0.1

caleb@aei-tech.com

Released under the Ruby license

12.09.05

Things you can do with a posixtimer:

timer = Posix::Timer.new

Arm the timer for 10 seconds

begin

timer.arm(10.0)

# ..do something

rescue SignalException

# The timer times out here

end

Specify which type of SIGNAL to use:

Posix::Timer.new("ALRM") # default

Posix::Timer.new("USR1")

...

Pass a block, and it will be called upon timeout

a = Posix::Timer.new do

puts "hi"

raise MyCustomException

end

a.arm(5.0)

sleep 10.0

=> "hi"

MyCustomException is raised

Caveats

The Posix::Timer instance uses POSIX signals to trigger

the timeouts. This may conflict with other signals you wish to

use in your application.

Passing a block to the constructor will perform a Signal.trap on

the signal. This may override an existing Signal.trap. In a future

version I intend to rollback the previous trap context.

Multiple timers using the same signal may conflict.

FAQs

Package last updated on 25 Jul 2009

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