Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

[MIRROR] Main Loop implementation to control subprocesses and threads

License

NotificationsYou must be signed in to change notification settings

RND-SOFT/main_loop

Repository files navigation

Gem VersionGemYARD

Test CoverageMaintainabilityQualityOutdatedVulnerabilities

MainLoop is a simple main application implementation to control subprocesses(children) and threads.

Features:

  • reaping children
  • handling SIGTERM SIGINT to shutdown children(and threads) gracefully
  • restarting children
  • termination the children

Usage

Example usage:

require'main_loop'logger=Logger.new(STDOUT)logger.level=Logger::DEBUGbus=MainLoop::Bus.newdispatcher=MainLoop::Dispatcher.new(bus,logger:logger)mainloop=MainLoop::Loop.new(bus,dispatcher,logger:logger)MainLoop::ProcessHandler.newdispatcher,'test1',retry_count:3,logger:loggerdosleep2exit!0endMainLoop::ProcessHandler.newdispatcher,'test2',retry_count:2,logger:loggerdotrap'TERM'doexit(0)endsleep2exit!1endMainLoop::ThreadHandler.newdispatcher,'thread2',retry_count:0,logger:loggerdosystem('sleep 15;echo ok')endmainloop.run

Installation

It's a gem:

  gem install main_loop

There's also the wonders ofthe Gemfile:

gem'main_loop'

About

[MIRROR] Main Loop implementation to control subprocesses and threads

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp