Sha256: 65a58cb969b498a944671db157db357207973093995991b84a287f7247ac8739
Contents?: true
Size: 520 Bytes
Versions: 5
Compression:
Stored size: 520 Bytes
Contents
module Elevate class Promise OUTSTANDING = 0 FULFILLED = 1 def initialize @lock = NSConditionLock.alloc.initWithCondition(OUTSTANDING) @result = nil end def fulfill(result) if @lock.tryLockWhenCondition(OUTSTANDING) @result = result @lock.unlockWithCondition(FULFILLED) end end def value result = nil @lock.lockWhenCondition(FULFILLED) result = @result @lock.unlockWithCondition(FULFILLED) result end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
elevate-0.6.0 | lib/elevate/promise.rb |
elevate-0.5.0 | lib/elevate/promise.rb |
elevate-0.4.0 | lib/elevate/promise.rb |
elevate-0.3.3 | lib/elevate/promise.rb |
elevate-0.3.2 | lib/elevate/promise.rb |