Module: Af::QThread::Interface

Included in:
Base
Defined in:
lib/fiksu-af/q_thread/interface.rb

Instance Method Summary collapse

Instance Method Details

#has_message?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/fiksu-af/q_thread/interface.rb', line 3

def has_message?
  return !queue.empty?
end

#post_data_message(data, from = Thread.current) ⇒ Object



19
20
21
# File 'lib/fiksu-af/q_thread/interface.rb', line 19

def post_data_message(data, from = Thread.current)
  post_message(::Af::QThread::Message.new(data, from))
end

#post_message(message) ⇒ Object



11
12
13
# File 'lib/fiksu-af/q_thread/interface.rb', line 11

def post_message(message)
  queue << message
end

#read_messageObject



7
8
9
# File 'lib/fiksu-af/q_thread/interface.rb', line 7

def read_message
  return queue.pop
end

#requeue(message) ⇒ Object



15
16
17
# File 'lib/fiksu-af/q_thread/interface.rb', line 15

def requeue(message)
  post_message(message)
end