Class: Semian::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/semian/resource.rb,
ext/semian/semian.c

Overview

Resource is the fundamental class of Semian. It is essentially a wrapper around a

SystemV semaphore.

You should not create this class directly, it will be created indirectly via Semian.register.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, tickets:, permissions: 0660, timeout: 0) ⇒ Resource

Returns a new instance of Resource.



5
6
7
8
9
# File 'lib/semian/resource.rb', line 5

def initialize(name, tickets:, permissions: 0660, timeout: 0)
  _initialize(name, tickets, permissions, timeout) if respond_to?(:_initialize)
  @name = name
  @tickets = tickets
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/semian/resource.rb', line 3

def name
  @name
end

#ticketsObject (readonly)

Returns the value of attribute tickets.



3
4
5
# File 'lib/semian/resource.rb', line 3

def tickets
  @tickets
end

Instance Method Details

#acquire {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



14
15
16
# File 'lib/semian/resource.rb', line 14

def acquire(*)
  yield self
end

#countObject



18
19
20
# File 'lib/semian/resource.rb', line 18

def count
  0
end

#destroyObject



11
12
# File 'lib/semian/resource.rb', line 11

def destroy
end

#semidObject



22
23
24
# File 'lib/semian/resource.rb', line 22

def semid
  0
end