Class: Semian::Resource
- Inherits:
-
Object
- Object
- Semian::Resource
- 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
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tickets ⇒ Object
readonly
Returns the value of attribute tickets.
Instance Method Summary collapse
- #acquire {|_self| ... } ⇒ Object
- #count ⇒ Object
- #destroy ⇒ Object
-
#initialize(name, tickets:, permissions: 0660, timeout: 0) ⇒ Resource
constructor
A new instance of Resource.
- #semid ⇒ Object
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, , timeout) if respond_to?(:_initialize) @name = name @tickets = tickets end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/semian/resource.rb', line 3 def name @name end |
#tickets ⇒ Object (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
14 15 16 |
# File 'lib/semian/resource.rb', line 14 def acquire(*) yield self end |
#count ⇒ Object
18 19 20 |
# File 'lib/semian/resource.rb', line 18 def count 0 end |
#destroy ⇒ Object
11 12 |
# File 'lib/semian/resource.rb', line 11 def destroy end |
#semid ⇒ Object
22 23 24 |
# File 'lib/semian/resource.rb', line 22 def semid 0 end |