Sha256: d63b5b7b748a75fd877492bb2d906458e866f6916c1c15b8ec464a49a624472b
Contents?: true
Size: 572 Bytes
Versions: 2
Compression:
Stored size: 572 Bytes
Contents
module Gtk3App module Slot using Rafini::Array def self.dbm SDBM.open(CONFIG[:SlotsDBM]){|db|yield(db)} end def self.numbers 1.upto(CONFIG[:Slots]){|n|yield(n.to_s)} end def self.get alive = Sys::ProcTable.ps.select{|p|p.cmdline=~/ruby.*\bgtk3app\b/}.map{|p|p.pid.to_s}.is(true) Slot.dbm do |db| Slot.numbers do |slot| unless alive[db[slot]] db[slot]=$$.to_s return slot.to_i end end end return nil end def self.release(slot) Slot.dbm{|db|db.delete(slot.to_s)} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gtk3app-1.5.2 | lib/gtk3app/slot.rb |
gtk3app-1.5.1 | lib/gtk3app/slot.rb |