Class: Qonfig::DataSet::Lock Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.13.0

Instance Method Summary collapse

Constructor Details

#initializevoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.13.0



10
11
12
13
14
# File 'lib/qonfig/data_set/lock.rb', line 10

def initialize
  @access_lock = Mutex.new
  @definition_lock = Mutex.new
  @arbitary_lock = Mutex.new
end

Instance Method Details

#thread_safe_access(&instructions) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • instructions (Block)

Since:

  • 0.13.0



30
31
32
33
34
35
36
37
38
39
# File 'lib/qonfig/data_set/lock.rb', line 30

def thread_safe_access(&instructions)
  if arbitary_lock.locked?
    # :nocov:
    # NOTE: covered in thread-based specs but simplecov can't gather this fact
    with_arbitary_access { acquire_access_lock(&instructions) } # :nocov:
    # :nocov:
  else
    acquire_access_lock(&instructions)
  end
end

#thread_safe_definition(&instructions) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • instructions (Block)

Since:

  • 0.13.0



46
47
48
49
50
51
52
53
54
55
# File 'lib/qonfig/data_set/lock.rb', line 46

def thread_safe_definition(&instructions)
  if arbitary_lock.locked?
    # :nocov:
    # NOTE: covered in thread-based specs but simplecov can't gather this fact
    with_arbitary_access { acquire_definition_lock(&instructions) }
    # :nocov:
  else
    acquire_definition_lock(&instructions)
  end
end

#with_arbitary_access(&instructions) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • instructions (Block)

Since:

  • 0.17.0



21
22
23
# File 'lib/qonfig/data_set/lock.rb', line 21

def with_arbitary_access(&instructions)
  acquire_arbitary_lock(&instructions)
end