File: //usr/local/rvm/gems/ruby-3.0.2/doc/concurrent-ruby-1.1.9/ri/Concurrent/IVar/cdesc-IVar.ri
U:RDoc::NormalClass[iI" IVar:ETI"Concurrent::IVar;TI"$Synchronization::LockableObject;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"QAn `IVar` is like a future that you can assign. As a future is a value that ;TI"Ris being computed that you can wait on, an `IVar` is a value that is waiting ;TI"Mto be assigned, that you can wait on. `IVars` are single assignment and ;TI"deterministic.;To:RDoc::Markup::BlankLine o; ;[I"RThen, express futures as an asynchronous computation that assigns an `IVar`. ;TI"EThe `IVar` becomes the primitive on which [futures](Future) and ;TI"$[dataflow](Dataflow) are built.;T@o; ;[ I"QAn `IVar` is a single-element container that is normally created empty, and ;TI"Lcan only be set once. The I in `IVar` stands for immutable. Reading an ;TI"R`IVar` normally blocks until it is set. It is safe to set and read an `IVar` ;TI"from different threads.;T@o; ;[ I"QIf you want to have some parallel task set the value in an `IVar`, you want ;TI"Na `Future`. If you want to create a graph of parallel tasks all executed ;TI"Mwhen the values they depend on are ready you want `dataflow`. `IVar` is ;TI"%generally a low-level primitive.;T@o; ;[I"## Examples;T@o; ;[I""Create, set and get an `IVar`;T@o; ;[I"
```ruby ;TI"!ivar = Concurrent::IVar.new ;TI"ivar.set 14 ;TI"ivar.value #=> 14 ;TI"(ivar.set 2 # would now be an error ;TI"```;T@o; ;[I"## See Also;T@o:RDoc::Markup::List:
@type:NUMBER:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"8For the theory: Arvind, R. Nikhil, and K. Pingali. ;TI"f[I-Structures: Data structures for parallel computing](http://dl.acm.org/citation.cfm?id=69562). ;TI"9In Proceedings of Workshop on Graph Reduction, 1986.;To;;0;[o; ;[I"For recent application: ;TI"}[DataDrivenFuture in Habanero Java from Rice](http://www.cs.rice.edu/~vs3/hjlib/doc/edu/rice/hj/api/HjDataDrivenFuture.html).;T:
@fileI"+lib/concurrent-ruby/concurrent/ivar.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [[I"Concern::Obligation;To;;[ ;@F;0I"+lib/concurrent-ruby/concurrent/ivar.rb;T[I"Concern::Observable;To;;[ ;@F;0@N[[I"
class;T[[:public[[I"new;T@N[:protected[ [:private[ [I"
instance;T[[;[[I"add_observer;T@N[;[[I"
complete;T@N[I""complete_without_notification;T@N[I" fail;T@N[I"notify_observers;T@N[I"%ns_complete_without_notification;T@N[I"ns_initialize;T@N[I"safe_execute;T@N[I"set;T@N[I"try_set;T@N[;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@FI"Concurrent;TcRDoc::NormalModule