3480 lines
110 KiB
HTML
3480 lines
110 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::FactoryMethods
|
|
|
|
— 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::FactoryMethods";
|
|
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 (F)</a> »
|
|
<span class='title'><span class='object_link'><a href="../../Concurrent.html" title="Concurrent (module)">Concurrent</a></span></span> » <span class='title'><span class='object_link'><a href="../Promises.html" title="Concurrent::Promises (module)">Promises</a></span></span>
|
|
»
|
|
<span class="title">FactoryMethods</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::FactoryMethods
|
|
|
|
|
|
|
|
</h1>
|
|
<div class="box_info">
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Extended by:</dt>
|
|
<dd><span class='object_link'><a href="../ReInclude.html" title="Concurrent::ReInclude (module)">ReInclude</a></span></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Includes:</dt>
|
|
<dd><span class='object_link'><a href="FactoryMethods/Configuration.html" title="Concurrent::Promises::FactoryMethods::Configuration (module)">Configuration</a></span>, <span class='object_link'><a href="FactoryMethods/NewChannelIntegration.html" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration (module)">NewChannelIntegration</a></span></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Included in:</dt>
|
|
<dd><span class='object_link'><a href="../Promises.html" title="Concurrent::Promises (module)">Concurrent::Promises</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/old_channel_integration.rb</span>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Container of all <span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span>, <span class='object_link'><a href="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span> factory methods. They are never constructed directly with
|
|
new.</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="FactoryMethods/Configuration.html" title="Concurrent::Promises::FactoryMethods::Configuration (module)">Configuration</a></span>, <span class='object_link'><a href="FactoryMethods/NewChannelIntegration.html" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration (module)">NewChannelIntegration</a></span>
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2>
|
|
Instance 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-instance_method" title="#any_event (instance method)">#<strong>any_event</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_event_on-instance_method" title="#any_event_on (instance method)">#<strong>any_event_on</strong>(default_executor, *futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#any_fulfilled_future (instance method)">#<strong>any_fulfilled_future</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_fulfilled_future_on-instance_method" title="#any_fulfilled_future_on (instance method)">#<strong>any_fulfilled_future_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#any_resolved_future (instance method)">#<strong>any_resolved_future</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
(also: #any)
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#any_resolved_future_on-instance_method" title="#any_resolved_future_on (instance method)">#<strong>any_resolved_future_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#default_executor (instance method)">#<strong>default_executor</strong> ⇒ Executor, :io, :fast </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
included
|
|
from <span class='object_link'><a href="FactoryMethods/Configuration.html#default_executor-instance_method" title="Concurrent::Promises::FactoryMethods::Configuration#default_executor (method)">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-instance_method" title="#delay (instance method)">#<strong>delay</strong>(*args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#delay_on-instance_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">#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-instance_method" title="#delay_on (instance method)">#<strong>delay_on</strong>(default_executor, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#fulfilled_future (instance method)">#<strong>fulfilled_future</strong>(value, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#future (instance method)">#<strong>future</strong>(*args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#future_on-instance_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">#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-instance_method" title="#future_on (instance method)">#<strong>future_on</strong>(default_executor, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#make_future (instance method)">#<strong>make_future</strong>(argument = nil, default_executor = self.default_executor) ⇒ Event, Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#rejected_future (instance method)">#<strong>rejected_future</strong>(reason, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#resolvable_event (instance method)">#<strong>resolvable_event</strong> ⇒ ResolvableEvent </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_event_on-instance_method" title="#resolvable_event_on (instance method)">#<strong>resolvable_event_on</strong>(default_executor = self.default_executor) ⇒ ResolvableEvent </a>
|
|
|
|
|
|
|
|
</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="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-instance_method" title="#resolvable_future (instance method)">#<strong>resolvable_future</strong> ⇒ ResolvableFuture </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#resolvable_future_on-instance_method" title="#resolvable_future_on (instance method)">#<strong>resolvable_future_on</strong>(default_executor = self.default_executor) ⇒ ResolvableFuture </a>
|
|
|
|
|
|
|
|
</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="ResolvableFuture.html#resolve-instance_method" title="Concurrent::Promises::ResolvableFuture#resolve (method)">ResolvableFuture#resolve</a></span>, <span class='object_link'><a href="ResolvableFuture.html#fulfill-instance_method" title="Concurrent::Promises::ResolvableFuture#fulfill (method)">ResolvableFuture#fulfill</a></span>, or <span class='object_link'><a href="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-instance_method" title="#resolved_event (instance method)">#<strong>resolved_event</strong>(default_executor = self.default_executor) ⇒ Event </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#resolved_future (instance method)">#<strong>resolved_future</strong>(fulfilled, value, reason, default_executor = self.default_executor) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#schedule (instance method)">#<strong>schedule</strong>(intended_time, *args, &task) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#schedule_on-instance_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">#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-instance_method" title="#schedule_on (instance method)">#<strong>schedule_on</strong>(default_executor, intended_time, *args) {|*args| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#select_channel (instance method)">#<strong>select_channel</strong>(*channels) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
<span class="note title not_defined_here">
|
|
included
|
|
from <span class='object_link'><a href="FactoryMethods/NewChannelIntegration.html#select_channel-instance_method" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration#select_channel (method)">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-instance_method" title="#zip_events (instance method)">#<strong>zip_events</strong>(*futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_events_on-instance_method" title="#zip_events_on (instance method)">#<strong>zip_events_on</strong>(default_executor, *futures_and_or_events) ⇒ Event </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#zip_futures (instance method)">#<strong>zip_futures</strong>(*futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
(also: #zip)
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures_on-instance_method" title="#zip_futures_on (instance method)">#<strong>zip_futures_on</strong>(default_executor, *futures_and_or_events) ⇒ Future </a>
|
|
|
|
|
|
|
|
</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-instance_method" title="#zip_futures_over (instance method)">#<strong>zip_futures_over</strong>(enumerable, &future_factory) ⇒ Future </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'><p>Shortcut of <span class='object_link'><a href="#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></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#zip_futures_over_on-instance_method" title="#zip_futures_over_on (instance method)">#<strong>zip_futures_over_on</strong>(default_executor, enumerable) {|element| ... } ⇒ Future </a>
|
|
|
|
|
|
|
|
</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="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="any_event-instance_method">
|
|
|
|
#<strong>any_event</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#any_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_event_on (method)">#any_event_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
294
|
|
295
|
|
296</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 294</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_event'>any_event</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_any_event_on'>any_event_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_event_on-instance_method">
|
|
|
|
#<strong>any_event_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
304
|
|
305
|
|
306</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 304</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_event_on'>any_event_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='const'>AnyResolvedEventPromise</span><span class='period'>.</span><span class='id identifier rubyid_new_blocked_by'>new_blocked_by</span><span class='lparen'>(</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_fulfilled_future-instance_method">
|
|
|
|
#<strong>any_fulfilled_future</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#any_fulfilled_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_fulfilled_future_on (method)">#any_fulfilled_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
275
|
|
276
|
|
277</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 275</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_fulfilled_future'>any_fulfilled_future</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_any_fulfilled_future_on'>any_fulfilled_future_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_fulfilled_future_on-instance_method">
|
|
|
|
#<strong>any_fulfilled_future_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
288
|
|
289
|
|
290</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 288</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_fulfilled_future_on'>any_fulfilled_future_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='const'>AnyFulfilledFuturePromise</span><span class='period'>.</span><span class='id identifier rubyid_new_blocked_by'>new_blocked_by</span><span class='lparen'>(</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_resolved_future-instance_method">
|
|
|
|
#<strong>any_resolved_future</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="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>
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#any_resolved_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#any_resolved_future_on (method)">#any_resolved_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
253
|
|
254
|
|
255</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 253</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_resolved_future'>any_resolved_future</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_any_resolved_future_on'>any_resolved_future_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="any_resolved_future_on-instance_method">
|
|
|
|
#<strong>any_resolved_future_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
269
|
|
270
|
|
271</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 269</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_any_resolved_future_on'>any_resolved_future_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='const'>AnyResolvedFuturePromise</span><span class='period'>.</span><span class='id identifier rubyid_new_blocked_by'>new_blocked_by</span><span class='lparen'>(</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="default_executor-instance_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="FactoryMethods/Configuration.html#default_executor-instance_method" title="Concurrent::Promises::FactoryMethods::Configuration#default_executor (method)">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-instance_method">
|
|
|
|
#<strong>delay</strong>(*args, &task) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#delay_on-instance_method" title="Concurrent::Promises::FactoryMethods#delay_on (method)">#delay_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
184
|
|
185
|
|
186</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 184</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_delay'>delay</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_delay_on'>delay_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="delay_on-instance_method">
|
|
|
|
#<strong>delay_on</strong>(default_executor, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
192
|
|
193
|
|
194</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 192</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_delay_on'>delay_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='const'>DelayPromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span><span class='period'>.</span><span class='id identifier rubyid_chain'>chain</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="fulfilled_future-instance_method">
|
|
|
|
#<strong>fulfilled_future</strong>(value, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
122
|
|
123
|
|
124</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 122</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_fulfilled_future'>fulfilled_future</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_resolved_future'>resolved_future</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="future-instance_method">
|
|
|
|
#<strong>future</strong>(*args, &task) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#future_on-instance_method" title="Concurrent::Promises::FactoryMethods#future_on (method)">#future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
91
|
|
92
|
|
93</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 91</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_future'>future</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_future_on'>future_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="future_on-instance_method">
|
|
|
|
#<strong>future_on</strong>(default_executor, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
105
|
|
106
|
|
107</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 105</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_future_on'>future_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='const'>ImmediateEventPromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="make_future-instance_method">
|
|
|
|
|
|
<span class="overload">#<strong>create</strong>(nil, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt> </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="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="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="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="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="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="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="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="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="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="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="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="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="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="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>, <tt><span class='object_link'><a href="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><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
168
|
|
169
|
|
170
|
|
171
|
|
172
|
|
173
|
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 168</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_make_future'>make_future</span><span class='lparen'>(</span><span class='id identifier rubyid_argument'>argument</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='kw'>case</span> <span class='id identifier rubyid_argument'>argument</span>
|
|
<span class='kw'>when</span> <span class='const'><span class='object_link'><a href="AbstractEventFuture.html" title="Concurrent::Promises::AbstractEventFuture (class)">AbstractEventFuture</a></span></span>
|
|
<span class='comment'># returning wrapper would change nothing
|
|
</span> <span class='id identifier rubyid_argument'>argument</span>
|
|
<span class='kw'>when</span> <span class='const'>Exception</span>
|
|
<span class='id identifier rubyid_rejected_future'>rejected_future</span> <span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>when</span> <span class='kw'>nil</span>
|
|
<span class='id identifier rubyid_resolved_event'>resolved_event</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_fulfilled_future'>fulfilled_future</span> <span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="rejected_future-instance_method">
|
|
|
|
#<strong>rejected_future</strong>(reason, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
130
|
|
131
|
|
132</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 130</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_rejected_future'>rejected_future</span><span class='lparen'>(</span><span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_resolved_future'>resolved_future</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_event-instance_method">
|
|
|
|
#<strong>resolvable_event</strong> ⇒ <tt><span class='object_link'><a href="ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#resolvable_event_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_event_on (method)">#resolvable_event_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
60
|
|
61
|
|
62</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 60</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolvable_event'>resolvable_event</span>
|
|
<span class='id identifier rubyid_resolvable_event_on'>resolvable_event_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_event_on-instance_method">
|
|
|
|
#<strong>resolvable_event_on</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="ResolvableEvent.html" title="Concurrent::Promises::ResolvableEvent (class)">ResolvableEvent</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
69
|
|
70
|
|
71</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 69</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolvable_event_on'>resolvable_event_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='const'>ResolvableEventPromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_future-instance_method">
|
|
|
|
#<strong>resolvable_future</strong> ⇒ <tt><span class='object_link'><a href="ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#resolvable_future_on-instance_method" title="Concurrent::Promises::FactoryMethods#resolvable_future_on (method)">#resolvable_future_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
75
|
|
76
|
|
77</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 75</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolvable_future'>resolvable_future</span>
|
|
<span class='id identifier rubyid_resolvable_future_on'>resolvable_future_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolvable_future_on-instance_method">
|
|
|
|
#<strong>resolvable_future_on</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="ResolvableFuture.html#resolve-instance_method" title="Concurrent::Promises::ResolvableFuture#resolve (method)">ResolvableFuture#resolve</a></span>, <span class='object_link'><a href="ResolvableFuture.html#fulfill-instance_method" title="Concurrent::Promises::ResolvableFuture#fulfill (method)">ResolvableFuture#fulfill</a></span>,
|
|
or <span class='object_link'><a href="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="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="ResolvableFuture.html" title="Concurrent::Promises::ResolvableFuture (class)">ResolvableFuture</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
85
|
|
86
|
|
87</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 85</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolvable_future_on'>resolvable_future_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='const'>ResolvableFuturePromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolved_event-instance_method">
|
|
|
|
#<strong>resolved_event</strong>(default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
138
|
|
139
|
|
140</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 138</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolved_event'>resolved_event</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='const'>ImmediateEventPromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="resolved_future-instance_method">
|
|
|
|
#<strong>resolved_future</strong>(fulfilled, value, reason, default_executor = self.default_executor) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
114
|
|
115
|
|
116</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 114</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_resolved_future'>resolved_future</span><span class='lparen'>(</span><span class='id identifier rubyid_fulfilled'>fulfilled</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span>
|
|
<span class='const'>ImmediateFuturePromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_fulfilled'>fulfilled</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="schedule-instance_method">
|
|
|
|
#<strong>schedule</strong>(intended_time, *args, &task) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#schedule_on-instance_method" title="Concurrent::Promises::FactoryMethods#schedule_on (method)">#schedule_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
198
|
|
199
|
|
200</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 198</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_schedule'>schedule</span><span class='lparen'>(</span><span class='id identifier rubyid_intended_time'>intended_time</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_schedule_on'>schedule_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_intended_time'>intended_time</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="schedule_on-instance_method">
|
|
|
|
#<strong>schedule_on</strong>(default_executor, intended_time, *args) {|*args| ... } ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
209
|
|
210
|
|
211</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 209</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_schedule_on'>schedule_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_intended_time'>intended_time</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='const'>ScheduledPromise</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Synchronization/Object.html#new-class_method" title="Concurrent::Synchronization::Object.new (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_intended_time'>intended_time</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span><span class='period'>.</span><span class='id identifier rubyid_chain'>chain</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="select_channel-instance_method">
|
|
|
|
#<strong>select_channel</strong>(*channels) ⇒ <tt><span class='object_link'><a href="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="FactoryMethods/NewChannelIntegration.html#select_channel-instance_method" title="Concurrent::Promises::FactoryMethods::NewChannelIntegration#select_channel (method)">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="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="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-instance_method">
|
|
|
|
#<strong>zip_events</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#zip_events_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_events_on (method)">#zip_events_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
237
|
|
238
|
|
239</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 237</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_events'>zip_events</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_zip_events_on'>zip_events_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_events_on-instance_method">
|
|
|
|
#<strong>zip_events_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="Event.html" title="Concurrent::Promises::Event (class)">Event</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
247
|
|
248
|
|
249</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 247</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_events_on'>zip_events_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='const'>ZipEventsPromise</span><span class='period'>.</span><span class='id identifier rubyid_new_blocked_by'>new_blocked_by</span><span class='lparen'>(</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures-instance_method">
|
|
|
|
#<strong>zip_futures</strong>(*futures_and_or_events) ⇒ <tt><span class='object_link'><a href="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>
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
<p>Shortcut of <span class='object_link'><a href="#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="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="#zip_futures_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_on (method)">#zip_futures_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
215
|
|
216
|
|
217</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 215</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_futures'>zip_futures</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_zip_futures_on'>zip_futures_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_on-instance_method">
|
|
|
|
#<strong>zip_futures_on</strong>(default_executor, *futures_and_or_events) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
229
|
|
230
|
|
231</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/concurrent/promises.rb', line 229</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_futures_on'>zip_futures_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='rparen'>)</span>
|
|
<span class='const'>ZipFuturesPromise</span><span class='period'>.</span><span class='id identifier rubyid_new_blocked_by'>new_blocked_by</span><span class='lparen'>(</span><span class='id identifier rubyid_futures_and_or_events'>futures_and_or_events</span><span class='comma'>,</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_future'>future</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_over-instance_method">
|
|
|
|
#<strong>zip_futures_over</strong>(enumerable, &future_factory) ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="#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="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="#zip_futures_over_on-instance_method" title="Concurrent::Promises::FactoryMethods#zip_futures_over_on (method)">#zip_futures_over_on</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
179
|
|
180
|
|
181</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib-edge/concurrent/edge/promises.rb', line 179</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_futures_over'>zip_futures_over</span><span class='lparen'>(</span><span class='id identifier rubyid_enumerable'>enumerable</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_future_factory'>future_factory</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_zip_futures_over_on'>zip_futures_over_on</span> <span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_enumerable'>enumerable</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_future_factory'>future_factory</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="zip_futures_over_on-instance_method">
|
|
|
|
#<strong>zip_futures_over_on</strong>(default_executor, enumerable) {|element| ... } ⇒ <tt><span class='object_link'><a href="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</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="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="Future.html" title="Concurrent::Promises::Future (class)">Future</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
197
|
|
198
|
|
199
|
|
200</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib-edge/concurrent/edge/promises.rb', line 197</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_zip_futures_over_on'>zip_futures_over_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='id identifier rubyid_enumerable'>enumerable</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_future_factory'>future_factory</span><span class='rparen'>)</span>
|
|
<span class='comment'># ZipFuturesPromise.new_blocked_by(futures_and_or_events, default_executor).future
|
|
</span> <span class='id identifier rubyid_zip_futures_on'>zip_futures_on</span><span class='lparen'>(</span><span class='id identifier rubyid_default_executor'>default_executor</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_enumerable'>enumerable</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='id identifier rubyid_future'>future</span> <span class='id identifier rubyid_e'>e</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_future_factory'>future_factory</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</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> |