Class: Sqreen::Js::ContextPool
- Inherits:
-
Object
- Object
- Sqreen::Js::ContextPool
- Defined in:
- lib/sqreen/js/context_pool.rb
Instance Method Summary collapse
-
#initialize ⇒ ContextPool
constructor
A new instance of ContextPool.
- #with_context(&block) ⇒ Object
Constructor Details
#initialize ⇒ ContextPool
Returns a new instance of ContextPool.
11 12 13 14 15 |
# File 'lib/sqreen/js/context_pool.rb', line 11 def initialize @mutex = Mutex.new @total_ctxs = 0 @contexts = [] end |
Instance Method Details
#with_context(&block) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/sqreen/js/context_pool.rb', line 17 def with_context(&block) isolate = context begin block[isolate] ensure give_back_context isolate end end |