Class: LS4::HTTPGatewayService::Responder
- Inherits:
-
Object
- Object
- LS4::HTTPGatewayService::Responder
- Defined in:
- lib/ls4/service/gw_http.rb
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#retval ⇒ Object
readonly
Returns the value of attribute retval.
Instance Method Summary collapse
- #error(err, retval = nil) ⇒ Object
-
#initialize ⇒ Responder
constructor
A new instance of Responder.
- #result(retval, err = nil) ⇒ Object
- #sent? ⇒ Boolean
- #wait ⇒ Object
Constructor Details
#initialize ⇒ Responder
Returns a new instance of Responder.
739 740 741 742 743 744 745 |
# File 'lib/ls4/service/gw_http.rb', line 739 def initialize @mutex = Mutex.new @cond = ConditionVariable.new @sent = false @retval = nil @err = nil end |
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
748 749 750 |
# File 'lib/ls4/service/gw_http.rb', line 748 def err @err end |
#retval ⇒ Object (readonly)
Returns the value of attribute retval.
747 748 749 |
# File 'lib/ls4/service/gw_http.rb', line 747 def retval @retval end |
Instance Method Details
#error(err, retval = nil) ⇒ Object
774 775 776 |
# File 'lib/ls4/service/gw_http.rb', line 774 def error(err, retval = nil) result(retval, err) end |
#result(retval, err = nil) ⇒ Object
762 763 764 765 766 767 768 769 770 771 772 |
# File 'lib/ls4/service/gw_http.rb', line 762 def result(retval, err=nil) @mutex.synchronize do unless @sent @retval = retval @err = err @sent = true @cond.signal end end nil end |
#sent? ⇒ Boolean
758 759 760 |
# File 'lib/ls4/service/gw_http.rb', line 758 def sent? @sent end |
#wait ⇒ Object
750 751 752 753 754 755 756 |
# File 'lib/ls4/service/gw_http.rb', line 750 def wait @mutex.synchronize do until @sent @cond.wait(@mutex) end end end |