3314 lines
100 KiB
HTML
3314 lines
100 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>
|
|
Module: Concurrent::Promises
|
|
|
|
— Concurrent Ruby
|
|
|
|
</title>
|
|
|
|
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
|
|
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
pathId = "Concurrent::Promises";
|
|
relpath = '../';
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<div class="nav_wrap">
|
|
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
<div id="resizer"></div>
|
|
</div>
|
|
|
|
<div id="main" tabindex="-1">
|
|
<div id="header">
|
|
<div id="menu">
|
|
|
|
<a href="../_index.html">Index (P)</a> »
|
|
<span class='title'><span class='object_link'><a href="../Concurrent.html" title="Concurrent (module)">Concurrent</a></span></span>
|
|
»
|
|
<span class="title">Promises</span>
|
|
|
|
</div>
|
|
|
|
<div id="search">
|
|
|
|
<a class="full_list_link" id="class_list_link"
|
|
href="../class_list.html">
|
|
|
|
<svg width="24" height="24">
|
|
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
</svg>
|
|
</a>
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<div id="content"><h1>Module: Concurrent::Promises
|
|
|
|
|
|
|
|
</h1>
|
|
<div class="box_info">
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Extended by:</dt>
|
|
<dd><span class='object_link'><a href="Promises/FactoryMethods.html" title="Concurrent::Promises::FactoryMethods (module)">FactoryMethods</a></span></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Defined in:</dt>
|
|
<dd>lib/concurrent/promises.rb<span class="defines">,<br />
|
|
lib-edge/concurrent/edge/promises.rb,<br /> lib-edge/concurrent/edge/throttle.rb,<br /> lib-edge/concurrent/edge/old_channel_integration.rb</span>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Promises is a new framework unifying former tools <code>Concurrent::Future</code>,
|
|
<code>Concurrent::Promise</code>, <code>Concurrent::IVar</code>, <code>Concurrent::Event</code>,
|
|
<code>Concurrent.dataflow</code>, <code>Delay</code>, and <code>TimerTask</code> of concurrent-ruby. It
|
|
extensively uses the new synchronization layer to make all the methods
|
|
<em>lock-free</em> (with the exception of obviously blocking operations like <code>#wait</code>,
|
|
<code>#value</code>, etc.). As a result it lowers danger of deadlocking and offers
|
|
better performance.</p>
|
|
|
|
<p>It provides similar tools as other promise libraries do, users coming from
|
|
other languages and other promise libraries will find the same tools here
|
|
(probably named differently though). The naming conventions were borrowed
|
|
heavily from JS promises.</p>
|
|
|
|
<p>This framework, however, is not just a re-implementation of other promise
|
|
library, it draws inspiration from many other promise libraries, adds new
|
|
ideas, and is integrated with other abstractions like actors and channels.</p>
|
|
|
|
<p>Therefore it is likely that user will find a suitable solution for a problem in
|
|
this framework. If the problem is simple user can pick one suitable
|
|
abstraction, e.g. just promises or actors. If the problem is complex user can
|
|
combine parts (promises, channels, actors) which were designed to work together
|
|
well to a solution. Rather than having to combine fragilely independent tools.</p>
|
|
|
|
<p>This framework allows its users to:</p>
|
|
|
|
<ul>
|
|
<li> Process tasks asynchronously</li>
|
|
<li> Chain, branch, and zip the asynchronous tasks together
|
|
|
|
<ul>
|
|
<li> Therefore, to create directed acyclic graph (hereafter DAG) of tasks</li>
|
|
</ul></li>
|
|
<li> Create delayed tasks (or delayed DAG of tasks)</li>
|
|
<li> Create scheduled tasks (or delayed DAG of tasks)</li>
|
|
<li> Deal with errors through rejections</li>
|
|
<li> Reduce danger of deadlocking</li>
|
|
<li> Control the concurrency level of tasks</li>
|
|
<li> Simulate thread-like processing without occupying threads
|
|
|
|
<ul>
|
|
<li> It allows to create tens of thousands simulations on one thread
|
|
pool</li>
|
|
<li> It works well on all Ruby implementations</li>
|
|
</ul></li>
|
|
<li> Use actors to maintain isolated states and to seamlessly combine
|
|
it with promises</li>
|
|
<li> Build parallel processing stream system with back
|
|
pressure (parts, which are not keeping up, signal to the other parts of the
|
|
system to slow down).</li>
|
|
</ul>
|
|
|
|
<p><strong>The <a href="../file.promises.out.html" title="guide">guide</a> is best place to start with promises.</strong></p>
|
|
|
|
<h1>Main classes</h1>
|
|
|
|
<p>The main public user-facing classes are <span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span> and
|
|
<span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span> which share common ancestor
|
|
<span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span>.</p>
|
|
|
|
<p><strong><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span>:</strong> </p>
|
|
|
|
<blockquote>
|
|
<p>Common ancestor of <span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span> and <span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span> classes, many shared methods are defined here.</p>
|
|
</blockquote>
|
|
|
|
<p><strong><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span>:</strong> </p>
|
|
|
|
<blockquote>
|
|
<p>Represents an event which will happen in future (will be resolved). The event is either
|
|
pending or resolved. It should be always resolved. Use <span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span> to communicate rejections and
|
|
cancellation.</p>
|
|
</blockquote>
|
|
|
|
<p><strong><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span>:</strong> </p>
|
|
|
|
<blockquote>
|
|
<p>Represents a value which will become available in future. May reject with a reason instead,
|
|
e.g. when the tasks raises an exception.</p>
|
|
</blockquote>
|
|
</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><h2>Defined Under Namespace</h2>
|
|
<p class="children">
|
|
|
|
|
|
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Promises/FactoryMethods.html" title="Concurrent::Promises::FactoryMethods (module)">FactoryMethods</a></span>, <span class='object_link'><a href="Promises/Resolvable.html" title="Concurrent::Promises::Resolvable (module)">Resolvable</a></span>
|
|
|
|
|
|
|
|
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span>, <span class='object_link'><a href="Promises/Channel.html" title="Concurrent::Promises::Channel (class)">Channel</a></span>, <span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span>, <span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span>, <span class='object_link'><a href="Promises/ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span>, <span class='object_link'><a href="Promises/ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2>
|
|
Class Method Summary
|
|
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
</h2>
|
|
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_event-class_method" title="#any_event (class method)">.<strong>any_event</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_event-class_method" title="Concurrent::Promises::FactoryMethods#any_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">FactoryMethods#any_event_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_event_on-class_method" title="#any_event_on (class method)">.<strong>any_event_on</strong>(default_executor, *futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_event_on-class_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new event which becomes resolved after first of the futures_and_or_events resolves.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_fulfilled_future-class_method" title="#any_fulfilled_future (class method)">.<strong>any_fulfilled_future</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future-class_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">FactoryMethods#any_fulfilled_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_fulfilled_future_on-class_method" title="#any_fulfilled_future_on (class method)">.<strong>any_fulfilled_future_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future_on-class_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new future which is resolved after first of futures_and_or_events is fulfilled.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_resolved_future-class_method" title="#any_resolved_future (class method)">.<strong>any_resolved_future</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
(also: #any)
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future-class_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">FactoryMethods#any_resolved_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_resolved_future_on-class_method" title="#any_resolved_future_on (class method)">.<strong>any_resolved_future_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future_on-class_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new future which is resolved after first futures_and_or_events is resolved.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#default_executor-class_method" title="#default_executor (class method)">.<strong>default_executor</strong> ⇒ Executor, :io, :fast </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods/Configuration.html#default_executor-class_method" title="Concurrent::Promises::FactoryMethods::Configuration#default_executor (method)">FactoryMethods::Configuration</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>The executor which is used when none is supplied to a factory method.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#delay-class_method" title="#delay (class method)">.<strong>delay</strong>(*args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#delay-class_method" title="Concurrent::Promises::FactoryMethods#delay (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#delay_on-instance_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">FactoryMethods#delay_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#delay_on-class_method" title="#delay_on (class method)">.<strong>delay_on</strong>(default_executor, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#delay_on-class_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Constructs new Future which will be resolved after block is evaluated on default executor.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#fulfilled_future-class_method" title="#fulfilled_future (class method)">.<strong>fulfilled_future</strong>(value, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#fulfilled_future-class_method" title="Concurrent::Promises::FactoryMethods#fulfilled_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates resolved future with will be fulfilled with the given value.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#future-class_method" title="#future (class method)">.<strong>future</strong>(*args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#future-class_method" title="Concurrent::Promises::FactoryMethods#future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#future_on-instance_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">FactoryMethods#future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#future_on-class_method" title="#future_on (class method)">.<strong>future_on</strong>(default_executor, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#future_on-class_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Constructs new Future which will be resolved after block is evaluated on default executor.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#make_future-class_method" title="#make_future (class method)">.<strong>make_future</strong>(argument = nil, default_executor = self.default_executor) ⇒ Event, Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#make_future-class_method" title="Concurrent::Promises::FactoryMethods#make_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>General constructor.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#rejected_future-class_method" title="#rejected_future (class method)">.<strong>rejected_future</strong>(reason, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#rejected_future-class_method" title="Concurrent::Promises::FactoryMethods#rejected_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates resolved future with will be rejected with the given reason.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_event-class_method" title="#resolvable_event (class method)">.<strong>resolvable_event</strong> ⇒ ResolvableEvent </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">FactoryMethods#resolvable_event_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_event_on-class_method" title="#resolvable_event_on (class method)">.<strong>resolvable_event_on</strong>(default_executor = self.default_executor) ⇒ ResolvableEvent </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event_on-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Created resolvable event, user is responsible for resolving the event once by <span class='object_link'><a href="Promises/ResolvableEvent.html#resolve-instance_method" title="Concurrent::Promises::ResolvableEvent#resolve (method)">ResolvableEvent#resolve</a></span>.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_future-class_method" title="#resolvable_future (class method)">.<strong>resolvable_future</strong> ⇒ ResolvableFuture </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">FactoryMethods#resolvable_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_future_on-class_method" title="#resolvable_future_on (class method)">.<strong>resolvable_future_on</strong>(default_executor = self.default_executor) ⇒ ResolvableFuture </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future_on-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates resolvable future, user is responsible for resolving the future once by <span class='object_link'><a href="Promises/ResolvableFuture.html#resolve-instance_method" title="Concurrent::Promises::ResolvableFuture#resolve (method)">ResolvableFuture#resolve</a></span>, <span class='object_link'><a href="Promises/ResolvableFuture.html#fulfill-instance_method" title="Concurrent::Promises::ResolvableFuture#fulfill (method)">ResolvableFuture#fulfill</a></span>, or <span class='object_link'><a href="Promises/ResolvableFuture.html#reject-instance_method" title="Concurrent::Promises::ResolvableFuture#reject (method)">ResolvableFuture#reject</a></span>.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolved_event-class_method" title="#resolved_event (class method)">.<strong>resolved_event</strong>(default_executor = self.default_executor) ⇒ Event </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolved_event-class_method" title="Concurrent::Promises::FactoryMethods#resolved_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates resolved event.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolved_future-class_method" title="#resolved_future (class method)">.<strong>resolved_future</strong>(fulfilled, value, reason, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#resolved_future-class_method" title="Concurrent::Promises::FactoryMethods#resolved_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates resolved future with will be either fulfilled with the given value or rejection with the given reason.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#schedule-class_method" title="#schedule (class method)">.<strong>schedule</strong>(intended_time, *args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#schedule-class_method" title="Concurrent::Promises::FactoryMethods#schedule (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#schedule_on-instance_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">FactoryMethods#schedule_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#schedule_on-class_method" title="#schedule_on (class method)">.<strong>schedule_on</strong>(default_executor, intended_time, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#schedule_on-class_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Constructs new Future which will be resolved after block is evaluated on default executor.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#select_channel-class_method" title="#select_channel (class method)">.<strong>select_channel</strong>(*channels) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods/NewChannelIntegration.html#select_channel-class_method" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration#select_channel (method)">FactoryMethods::NewChannelIntegration</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Selects a channel which is ready to be read from.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_events-class_method" title="#zip_events (class method)">.<strong>zip_events</strong>(*futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_events-class_method" title="Concurrent::Promises::FactoryMethods#zip_events (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_events_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">FactoryMethods#zip_events_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_events_on-class_method" title="#zip_events_on (class method)">.<strong>zip_events_on</strong>(default_executor, *futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_events_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new event which is resolved after all futures_and_or_events are resolved.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures-class_method" title="#zip_futures (class method)">.<strong>zip_futures</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
(also: #zip)
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">FactoryMethods#zip_futures_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures_on-class_method" title="#zip_futures_on (class method)">.<strong>zip_futures_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new future which is resolved after all futures_and_or_events are resolved.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures_over-class_method" title="#zip_futures_over (class method)">.<strong>zip_futures_over</strong>(enumerable, &future_factory) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">FactoryMethods#zip_futures_over_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures_over_on-class_method" title="#zip_futures_over_on (class method)">.<strong>zip_futures_over_on</strong>(default_executor, enumerable) {|element| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
extended
|
|
from <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Creates new future which is resolved after all the futures created by future_factory from enumerable elements are resolved.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="class_method_details" class="method_details_list">
|
|
<h2>Class Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="any_event-class_method">
|
|
|
|
.<strong>any_event</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_event-class_method" title="Concurrent::Promises::FactoryMethods#any_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">#any_event_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#any_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">#any_event_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_event_on-class_method">
|
|
|
|
.<strong>any_event_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_event_on-class_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates new event which becomes resolved after first of the futures_and_or_events resolves.
|
|
If resolved it does not propagate <span class='object_link'><a href="Promises/AbstractEventFuture.html#touch-instance_method" title="Concurrent::Promises::AbstractEventFuture#touch (method)">AbstractEventFuture#touch</a></span>, leaving delayed
|
|
futures un-executed if they are not required any more.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>futures_and_or_events</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_fulfilled_future-class_method">
|
|
|
|
.<strong>any_fulfilled_future</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future-class_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">#any_fulfilled_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">#any_fulfilled_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_fulfilled_future_on-class_method">
|
|
|
|
.<strong>any_fulfilled_future_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_fulfilled_future_on-class_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates new future which is resolved after first of futures_and_or_events is fulfilled.
|
|
Its result equals result of the first resolved future or if all futures_and_or_events reject,
|
|
it has reason of the last resolved future.
|
|
If resolved it does not propagate <span class='object_link'><a href="Promises/AbstractEventFuture.html#touch-instance_method" title="Concurrent::Promises::AbstractEventFuture#touch (method)">AbstractEventFuture#touch</a></span>, leaving delayed
|
|
futures un-executed if they are not required any more.
|
|
If event is supplied, which does not have value and can be only resolved, it's
|
|
represented as <code>:fulfilled</code> with value <code>nil</code>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>futures_and_or_events</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_resolved_future-class_method">
|
|
|
|
.<strong>any_resolved_future</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
<span class="aliases">Also known as:
|
|
<span class="names"><span id='any-instance_method'>any</span></span>
|
|
</span>
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future-class_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">#any_resolved_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">#any_resolved_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_resolved_future_on-class_method">
|
|
|
|
.<strong>any_resolved_future_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#any_resolved_future_on-class_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates new future which is resolved after first futures_and_or_events is resolved.
|
|
Its result equals result of the first resolved future.
|
|
If resolved it does not propagate <span class='object_link'><a href="Promises/AbstractEventFuture.html#touch-instance_method" title="Concurrent::Promises::AbstractEventFuture#touch (method)">AbstractEventFuture#touch</a></span>, leaving delayed
|
|
futures un-executed if they are not required any more.
|
|
If event is supplied, which does not have value and can be only resolved, it's
|
|
represented as <code>:fulfilled</code> with value <code>nil</code>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>futures_and_or_events</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="default_executor-class_method">
|
|
|
|
.<strong>default_executor</strong> ⇒ <tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods/Configuration.html#default_executor-class_method" title="Concurrent::Promises::FactoryMethods::Configuration#default_executor (method)">FactoryMethods::Configuration</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns the executor which is used when none is supplied
|
|
to a factory method. The method can be overridden in the receivers of
|
|
<code>include FactoryMethod</code></p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>the executor which is used when none is supplied
|
|
to a factory method. The method can be overridden in the receivers of
|
|
<code>include FactoryMethod</code></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="delay-class_method">
|
|
|
|
.<strong>delay</strong>(*args, &task) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#delay-class_method" title="Concurrent::Promises::FactoryMethods#delay (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#delay_on-instance_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">#delay_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#delay_on-instance_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">#delay_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="delay_on-class_method">
|
|
|
|
.<strong>delay_on</strong>(default_executor, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#delay_on-class_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Constructs new Future which will be resolved after block is evaluated on default executor.
|
|
The task will be evaluated only after the future is touched, see <span class='object_link'><a href="Promises/AbstractEventFuture.html#touch-instance_method" title="Concurrent::Promises::AbstractEventFuture#touch (method)">AbstractEventFuture#touch</a></span></p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>args</span>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>arguments which are passed to the task when it's executed.
|
|
(It might be prepended with other arguments, see the @yeild section).</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Yields:</p>
|
|
<ul class="yield">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>*args</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>to the task.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Yield Returns:</p>
|
|
<ul class="yieldreturn">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'></span>
|
|
|
|
|
|
|
|
|
|
<div class='inline'><p>will become result of the returned Future.
|
|
Its returned value becomes <span class='object_link'><a href="Promises/Future.html#value-instance_method" title="Concurrent::Promises::Future#value (method)">Concurrent::Promises::Future#value</a></span> fulfilling it,
|
|
raised exception becomes <span class='object_link'><a href="Promises/Future.html#reason-instance_method" title="Concurrent::Promises::Future#reason (method)">Concurrent::Promises::Future#reason</a></span> rejecting it.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="fulfilled_future-class_method">
|
|
|
|
.<strong>fulfilled_future</strong>(value, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#fulfilled_future-class_method" title="Concurrent::Promises::FactoryMethods#fulfilled_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates resolved future with will be fulfilled with the given value.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="future-class_method">
|
|
|
|
.<strong>future</strong>(*args, &task) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#future-class_method" title="Concurrent::Promises::FactoryMethods#future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#future_on-instance_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">#future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#future_on-instance_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">#future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="future_on-class_method">
|
|
|
|
.<strong>future_on</strong>(default_executor, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#future_on-class_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Constructs new Future which will be resolved after block is evaluated on default executor.
|
|
Evaluation begins immediately.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>args</span>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>arguments which are passed to the task when it's executed.
|
|
(It might be prepended with other arguments, see the @yeild section).</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Yields:</p>
|
|
<ul class="yield">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>*args</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>to the task.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Yield Returns:</p>
|
|
<ul class="yieldreturn">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'></span>
|
|
|
|
|
|
|
|
|
|
<div class='inline'><p>will become result of the returned Future.
|
|
Its returned value becomes <span class='object_link'><a href="Promises/Future.html#value-instance_method" title="Concurrent::Promises::Future#value (method)">Concurrent::Promises::Future#value</a></span> fulfilling it,
|
|
raised exception becomes <span class='object_link'><a href="Promises/Future.html#reason-instance_method" title="Concurrent::Promises::Future#reason (method)">Concurrent::Promises::Future#reason</a></span> rejecting it.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="make_future-class_method">
|
|
|
|
|
|
<span class="overload">#<strong>create</strong>(nil, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt> </span>
|
|
|
|
<span class="overload">#<strong>create</strong>(a_future, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
|
|
<span class="overload">#<strong>create</strong>(an_event, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt> </span>
|
|
|
|
<span class="overload">#<strong>create</strong>(exception, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
|
|
<span class="overload">#<strong>create</strong>(value, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#make_future-class_method" title="Concurrent::Promises::FactoryMethods#make_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>General constructor. Behaves differently based on the argument's type. It's provided for convenience
|
|
but it's better to be explicit.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Overloads:</p>
|
|
<ul class="overload">
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>create</strong>(nil, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns resolved event.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>nil</span>
|
|
|
|
|
|
<span class='type'>(<tt>nil</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>resolved event.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>create</strong>(a_future, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns a future which will be resolved when a_future is.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>a_future</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>a future which will be resolved when a_future is.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>create</strong>(an_event, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns an event which will be resolved when an_event is.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>an_event</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>an event which will be resolved when an_event is.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>create</strong>(exception, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns a rejected future with the exception as its reason.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>exception</span>
|
|
|
|
|
|
<span class='type'>(<tt>Exception</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>a rejected future with the exception as its reason.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
|
|
<li class="overload_item">
|
|
<span class="signature">#<strong>create</strong>(value, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </span>
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
<p>Returns a fulfilled future with the value.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>value</span>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>when none of the above overloads fits</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>a fulfilled future with the value.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>, <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li>resolved_event, fulfilled_future</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="rejected_future-class_method">
|
|
|
|
.<strong>rejected_future</strong>(reason, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#rejected_future-class_method" title="Concurrent::Promises::FactoryMethods#rejected_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates resolved future with will be rejected with the given reason.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_event-class_method">
|
|
|
|
.<strong>resolvable_event</strong> ⇒ <tt><span class='object_link'><a href="Promises/ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">#resolvable_event_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">#resolvable_event_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_event_on-class_method">
|
|
|
|
.<strong>resolvable_event_on</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_event_on-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Created resolvable event, user is responsible for resolving the event once by
|
|
<span class='object_link'><a href="Promises/ResolvableEvent.html#resolve-instance_method" title="Concurrent::Promises::ResolvableEvent#resolve (method)">ResolvableEvent#resolve</a></span>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_future-class_method">
|
|
|
|
.<strong>resolvable_future</strong> ⇒ <tt><span class='object_link'><a href="Promises/ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">#resolvable_future_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">#resolvable_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_future_on-class_method">
|
|
|
|
.<strong>resolvable_future_on</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolvable_future_on-class_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates resolvable future, user is responsible for resolving the future once by
|
|
<span class='object_link'><a href="Promises/ResolvableFuture.html#resolve-instance_method" title="Concurrent::Promises::ResolvableFuture#resolve (method)">ResolvableFuture#resolve</a></span>, <span class='object_link'><a href="Promises/ResolvableFuture.html#fulfill-instance_method" title="Concurrent::Promises::ResolvableFuture#fulfill (method)">ResolvableFuture#fulfill</a></span>,
|
|
or <span class='object_link'><a href="Promises/ResolvableFuture.html#reject-instance_method" title="Concurrent::Promises::ResolvableFuture#reject (method)">ResolvableFuture#reject</a></span></p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolved_event-class_method">
|
|
|
|
.<strong>resolved_event</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolved_event-class_method" title="Concurrent::Promises::FactoryMethods#resolved_event (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates resolved event.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolved_future-class_method">
|
|
|
|
.<strong>resolved_future</strong>(fulfilled, value, reason, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#resolved_future-class_method" title="Concurrent::Promises::FactoryMethods#resolved_future (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates resolved future with will be either fulfilled with the given value or rejection with
|
|
the given reason.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>self.default_executor</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="schedule-class_method">
|
|
|
|
.<strong>schedule</strong>(intended_time, *args, &task) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#schedule-class_method" title="Concurrent::Promises::FactoryMethods#schedule (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#schedule_on-instance_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">#schedule_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#schedule_on-instance_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">#schedule_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="schedule_on-class_method">
|
|
|
|
.<strong>schedule_on</strong>(default_executor, intended_time, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#schedule_on-class_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Constructs new Future which will be resolved after block is evaluated on default executor.
|
|
The task is planned for execution in intended_time.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>args</span>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>arguments which are passed to the task when it's executed.
|
|
(It might be prepended with other arguments, see the @yeild section).</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>intended_time</span>
|
|
|
|
|
|
<span class='type'>(<tt>Numeric</tt>, <tt>Time</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p><code>Numeric</code> means to run in <code>intended_time</code> seconds.
|
|
<code>Time</code> means to run on <code>intended_time</code>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Yields:</p>
|
|
<ul class="yield">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>*args</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>to the task.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Yield Returns:</p>
|
|
<ul class="yieldreturn">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'></span>
|
|
|
|
|
|
|
|
|
|
<div class='inline'><p>will become result of the returned Future.
|
|
Its returned value becomes <span class='object_link'><a href="Promises/Future.html#value-instance_method" title="Concurrent::Promises::Future#value (method)">Concurrent::Promises::Future#value</a></span> fulfilling it,
|
|
raised exception becomes <span class='object_link'><a href="Promises/Future.html#reason-instance_method" title="Concurrent::Promises::Future#reason (method)">Concurrent::Promises::Future#reason</a></span> rejecting it.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="select_channel-class_method">
|
|
|
|
.<strong>select_channel</strong>(*channels) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods/NewChannelIntegration.html#select_channel-class_method" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration#select_channel (method)">FactoryMethods::NewChannelIntegration</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Selects a channel which is ready to be read from.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>channels</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Channel.html" title="Concurrent::Promises::Channel (class)">Channel</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>a future which is fulfilled with pair [channel, message] when one of the channels is
|
|
available for reading</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_events-class_method">
|
|
|
|
.<strong>zip_events</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_events-class_method" title="Concurrent::Promises::FactoryMethods#zip_events (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_events_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">#zip_events_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#zip_events_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">#zip_events_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_events_on-class_method">
|
|
|
|
.<strong>zip_events_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_events_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates new event which is resolved after all futures_and_or_events are resolved.
|
|
(Future is resolved when fulfilled or rejected.)</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>futures_and_or_events</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures-class_method">
|
|
|
|
.<strong>zip_futures</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
<span class="aliases">Also known as:
|
|
<span class="names"><span id='zip-instance_method'>zip</span></span>
|
|
</span>
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">#zip_futures_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">#zip_futures_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_on-class_method">
|
|
|
|
.<strong>zip_futures_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Creates new future which is resolved after all futures_and_or_events are resolved.
|
|
Its value is array of zipped future values. Its reason is array of reasons for rejection.
|
|
If there is an error it rejects.
|
|
If event is supplied, which does not have value and can be only resolved, it's
|
|
represented as <code>:fulfilled</code> with value <code>nil</code>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>futures_and_or_events</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_over-class_method">
|
|
|
|
.<strong>zip_futures_over</strong>(enumerable, &future_factory) ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<div class="note notetag">
|
|
<strong>Note:</strong>
|
|
<div class='inline'><p><strong>Edge Features</strong> are under active development and may change frequently.</p>
|
|
|
|
<ul>
|
|
<li> Deprecations are not added before incompatible changes.</li>
|
|
<li> Edge version: <em>major</em> is always 0, <em>minor</em> bump means incompatible change,
|
|
<em>patch</em> bump means compatible change.</li>
|
|
<li> Edge features may also lack tests and documentation.</li>
|
|
<li> Features developed in <code>concurrent-ruby-edge</code> are expected to move
|
|
to <code>concurrent-ruby</code> when finalised.</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Shortcut of <span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">#zip_futures_over_on</a></span> with default <code>:io</code> executor supplied.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">#zip_futures_over_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_over_on-class_method">
|
|
|
|
.<strong>zip_futures_over_on</strong>(default_executor, enumerable) {|element| ... } ⇒ <tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="not_defined_here">
|
|
Originally defined in module
|
|
<span class='object_link'><a href="Promises/FactoryMethods.html#zip_futures_over_on-class_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">FactoryMethods</a></span>
|
|
</span>
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<div class="note notetag">
|
|
<strong>Note:</strong>
|
|
<div class='inline'><p><strong>Edge Features</strong> are under active development and may change frequently.</p>
|
|
|
|
<ul>
|
|
<li> Deprecations are not added before incompatible changes.</li>
|
|
<li> Edge version: <em>major</em> is always 0, <em>minor</em> bump means incompatible change,
|
|
<em>patch</em> bump means compatible change.</li>
|
|
<li> Edge features may also lack tests and documentation.</li>
|
|
<li> Features developed in <code>concurrent-ruby-edge</code> are expected to move
|
|
to <code>concurrent-ruby</code> when finalised.</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Creates new future which is resolved after all the futures created by future_factory from
|
|
enumerable elements are resolved. Simplified it does:
|
|
<code>zip(*enumerable.map { |e| future e, &future_factory })</code></p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<div class="examples">
|
|
<p class="tag_title">Examples:</p>
|
|
|
|
|
|
<pre class="example code"><code><span class='comment'># `#succ` calls are executed in parallel
|
|
</span><span class='id identifier rubyid_zip_futures_over_on'>zip_futures_over_on</span><span class='lparen'>(</span><span class='symbol'>:io</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='op'>&</span><span class='symbol'>:succ</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_value!'>value!</span> <span class='comment'># => [2, 3]</span></code></pre>
|
|
|
|
</div>
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>default_executor</span>
|
|
|
|
|
|
<span class='type'>(<tt>Executor</tt>, <tt>:io</tt>, <tt>:fast</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>Instance of an executor or a name of the
|
|
global executor. Default executor propagates to chained futures unless overridden with
|
|
executor parameter or changed with <span class='object_link'><a href="Promises/AbstractEventFuture.html#with_default_executor-instance_method" title="Concurrent::Promises::AbstractEventFuture#with_default_executor (method)">AbstractEventFuture#with_default_executor</a></span>.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>enumerable</span>
|
|
|
|
|
|
<span class='type'>(<tt>Enumerable</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Yields:</p>
|
|
<ul class="yield">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'></span>
|
|
|
|
|
|
|
|
|
|
<div class='inline'><p>a task to be executed in future</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Yield Parameters:</p>
|
|
<ul class="yieldparam">
|
|
|
|
<li>
|
|
|
|
<span class='name'>element</span>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>from enumerable</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Yield Returns:</p>
|
|
<ul class="yieldreturn">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'><p>a value of the future</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="Promises/Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_blank">yard</a>.
|
|
</div>
|
|
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-57940973-1', 'auto');
|
|
ga('send', 'pageview');
|
|
|
|
</script>
|
|
|
|
</div>
|
|
</body>
|
|
</html> |