Class: VirtualBox::COM::Model::Progress
- Inherits:
-
NSISupports
- Object
- AbstractModel
- AbstractInterface
- NSISupports
- VirtualBox::COM::Model::Progress
- Defined in:
- lib/virtualbox/com/model/4.2.rb,
lib/virtualbox/com/model/4.1-generated.rb,
lib/virtualbox/com/model/4.2-generated.rb
Instance Attribute Summary
Attributes inherited from AbstractInterface
Instance Method Summary collapse
-
#wait(interval_percent = 1) ⇒ Object
This method blocks the execution while the operations represented by this Progress object execute, but yields a block every ‘x` percent (interval given in parameters).
Methods inherited from AbstractInterface
#cast, function, functions, #initialize, #inspect, member, members, properties, property
Methods inherited from AbstractModel
Constructor Details
This class inherits a constructor from VirtualBox::COM::AbstractInterface
Instance Method Details
#wait(interval_percent = 1) ⇒ Object
This method blocks the execution while the operations represented by this VirtualBox::COM::Model::Progress object execute, but yields a block every ‘x` percent (interval given in parameters).
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/virtualbox/com/model/4.2.rb', line 67 def wait(interval_percent=1) # If no block is given we just wait until completion, not worrying # about tracking percentages. if !block_given? wait_for_completion(-1) return end # Initial value forces the 0% yield last_reported = -100 while true delta = percent - last_reported last_reported += delta yield self if delta >= interval_percent # This either sleeps for half a second or returns on completion wait_for_completion(500) break if completed || canceled # Pass off execution so other threads can run Thread.pass end end |