Sha256: 986677d1f538027acbbbe1fe0bee2275a542dfdd2c987293cf5a45d51529209f
Contents?: true
Size: 671 Bytes
Versions: 20
Compression:
Stored size: 671 Bytes
Contents
module Mixpanel::Async WORKER_MUTEX = Mutex.new def worker WORKER_MUTEX.synchronize do @worker || (@worker = IO.popen(self.cmd, 'w')) end end def dispose_worker(w) WORKER_MUTEX.synchronize do if(@worker == w) @worker = nil w.close end end end protected def cmd @cmd || begin require 'escape' require 'rbconfig' interpreter = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"] subprocess = File.join(File.dirname(__FILE__), 'subprocess.rb') @cmd = Escape.shell_command([interpreter, subprocess]) end end end
Version data entries
20 entries across 20 versions & 1 rubygems