Module: UniqueId

Included in:
ContextR::EventMachine::ClassMethods
Defined in:
lib/contextr/modules/unique_id.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#last_unique_idObject



10
11
12
# File 'lib/contextr/modules/unique_id.rb', line 10

def last_unique_id
  $gen_unique_id ||= 0
end

#new_unique_idObject



2
3
4
5
6
7
8
# File 'lib/contextr/modules/unique_id.rb', line 2

def new_unique_id
  $id_semaphore ||= Mutex.new
  $id_semaphore.synchronize do
    $gen_unique_id ||= 0
    $gen_unique_id += 1
  end
end