Parent

Class/Module Index [+]

Quicksearch

PhusionPassenger::UnionStation::Connection

Attributes

channel[RW]
mutex[R]

Public Class Methods

new(io) click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 33
def initialize(io)
        @mutex = Mutex.new
        @refcount = 1
        @channel = MessageChannel.new(io) if io
end

Public Instance Methods

connected?() click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 39
def connected?
        return !!@channel
end
disconnect() click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 43
def disconnect
        @channel.close if @channel
        @channel = nil
end
ref() click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 48
def ref
        @refcount += 1
end
synchronize() click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 59
def synchronize
        @mutex.synchronize do
                yield
        end
end
unref() click to toggle source
# File lib/phusion_passenger/union_station/connection.rb, line 52
def unref
        @refcount -= 1
        if @refcount == 0
                disconnect
        end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.