Class: Mount::Lock

Inherits:
Object
  • Object
show all
Defined in:
lib/rbmount/lock.rb

Instance Method Summary collapse

Constructor Details

#initialize(datafile, id) ⇒ Lock

Returns a new instance of Lock.



24
25
26
27
28
29
# File 'lib/rbmount/lock.rb', line 24

def initialize (datafile, id)
  @pointer = Mount::C.mnt_new_lock(datafile, id)
  raise unless @pointer

  ObjectSpace.define_finalizer(self, method(:finalize))
end

Instance Method Details

#block_signalsObject



39
40
41
# File 'lib/rbmount/lock.rb', line 39

def block_signals
  Mount::C.mnt_lock_block_signals(@pointer)
end

#finalizeObject



43
44
45
# File 'lib/rbmount/lock.rb', line 43

def finalize
  Mount::C.mnt_free_lock(@pointer)
end

#lock_fileObject



31
32
33
# File 'lib/rbmount/lock.rb', line 31

def lock_file
  Mount::C.mnt_lock_file(@pointer)
end

#to_cObject



47
48
49
# File 'lib/rbmount/lock.rb', line 47

def to_c
  @pointer
end

#unlock_fileObject



35
36
37
# File 'lib/rbmount/lock.rb', line 35

def unlock_file
  Mount::C.mnt_unlock_file(@pointer)
end