123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="generator" content="rustdoc">
- <meta name="description" content="API documentation for the Rust `Atomic` struct in crate `crossbeam`.">
- <meta name="keywords" content="rust, rustlang, rust-lang, Atomic">
- <title>crossbeam::epoch::Atomic - Rust</title>
- <link rel="stylesheet" type="text/css" href="../../normalize.css">
- <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
-
- <link rel="stylesheet" type="text/css" href="../../dark.css">
- <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
- <script src="../../storage.js"></script>
-
-
-
- </head>
- <body class="rustdoc struct">
- <!--[if lte IE 8]>
- <div class="warning">
- This old browser is unsupported and will most likely display funky
- things.
- </div>
- <![endif]-->
-
- <nav class="sidebar">
- <div class="sidebar-menu">☰</div>
-
- <p class='location'>Struct Atomic</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.null">null</a><a href="#method.new">new</a><a href="#method.load">load</a><a href="#method.store">store</a><a href="#method.store_and_ref">store_and_ref</a><a href="#method.store_shared">store_shared</a><a href="#method.cas">cas</a><a href="#method.cas_and_ref">cas_and_ref</a><a href="#method.cas_shared">cas_shared</a><a href="#method.swap">swap</a><a href="#method.swap_shared">swap_shared</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div></div><p class='location'><a href='../index.html'>crossbeam</a>::<wbr><a href='index.html'>epoch</a></p><script>window.sidebarCurrent = {name: 'Atomic', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
- </nav>
- <div class="theme-picker">
- <button id="theme-picker" aria-label="Pick another theme!">
- <img src="../../brush.svg" width="18" alt="Pick another theme!">
- </button>
- <div id="theme-choices"></div>
- </div>
- <script src="../../theme.js"></script>
- <nav class="sub">
- <form class="search-form js-only">
- <div class="search-container">
- <input class="search-input" name="search"
- autocomplete="off"
- placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
- type="search">
- </div>
- </form>
- </nav>
- <section id='main' class="content">
- <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>crossbeam</a>::<wbr><a href='index.html'>epoch</a>::<wbr><a class="struct" href=''>Atomic</a></span><span class='out-of-band'><span id='render-detail'>
- <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
- [<span class='inner'>−</span>]
- </a>
- </span><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#13-16' title='goto source code'>[src]</a></span></h1>
- <pre class='rust struct'>pub struct Atomic<T> { /* fields omitted */ }</pre><div class='docblock'><p>Like <code>std::sync::atomic::AtomicPtr</code>.</p>
- <p>Provides atomic access to a (nullable) pointer of type <code>T</code>, interfacing with
- the <code>Owned</code> and <code>Shared</code> types.</p>
- </div>
- <h2 id='methods' class='small-section-header'>
- Methods<a href='#methods' class='anchor'></a>
- </h2>
- <h3 id='impl' class='impl'><span class='in-band'><code>impl<T> <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#35-181' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'><h4 id='method.null' class="method"><span id='null.v' class='invisible'><code>pub fn <a href='#method.null' class='fnname'>null</a>() -> <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#46-51' title='goto source code'>[src]</a></span></h4>
- <h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(data: T) -> <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#54-59' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Create a new atomic pointer</p>
- </div><h4 id='method.load' class="method"><span id='load.v' class='invisible'><code>pub fn <a href='#method.load' class='fnname'>load</a><'a>(&self, ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, _: &'a <a class="struct" href="../../crossbeam/epoch/struct.Guard.html" title="struct crossbeam::epoch::Guard">Guard</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><'a, T>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#72-74' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic load with the given memory ordering.</p>
- <p>In order to perform the load, we must pass in a borrow of a
- <code>Guard</code>. This is a way of guaranteeing that the thread has pinned the
- epoch for the entire lifetime <code>'a</code>. In return, you get an optional
- <code>Shared</code> pointer back (<code>None</code> if the <code>Atomic</code> is currently null), with
- lifetime tied to the guard.</p>
- <h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
- <p>Panics if <code>ord</code> is <code>Release</code> or <code>AcqRel</code>.</p>
- </div><h4 id='method.store' class="method"><span id='store.v' class='invisible'><code>pub fn <a href='#method.store' class='fnname'>store</a>(&self, val: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>>, ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#84-86' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic store with the given memory ordering.</p>
- <p>Transfers ownership of the given <code>Owned</code> pointer, if any. Since no
- lifetime information is acquired, no <code>Guard</code> value is needed.</p>
- <h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
- <p>Panics if <code>ord</code> is <code>Acquire</code> or <code>AcqRel</code>.</p>
- </div><h4 id='method.store_and_ref' class="method"><span id='store_and_ref.v' class='invisible'><code>pub fn <a href='#method.store_and_ref' class='fnname'>store_and_ref</a><'a>(<br> &self, <br> val: <a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, <br> _: &'a <a class="struct" href="../../crossbeam/epoch/struct.Guard.html" title="struct crossbeam::epoch::Guard">Guard</a><br>) -> <a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><'a, T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#98-106' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic store with the given memory ordering, immediately yielding
- a shared reference to the pointer that was stored.</p>
- <p>Transfers ownership of the given <code>Owned</code> pointer, yielding a <code>Shared</code>
- reference to it. Since the reference is valid only for the curent epoch,
- it's lifetime is tied to a <code>Guard</code> value.</p>
- <h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
- <p>Panics if <code>ord</code> is <code>Acquire</code> or <code>AcqRel</code>.</p>
- </div><h4 id='method.store_shared' class="method"><span id='store_shared.v' class='invisible'><code>pub fn <a href='#method.store_shared' class='fnname'>store_shared</a>(&self, val: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#116-118' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic store of a <code>Shared</code> pointer with the given memory ordering.</p>
- <p>This operation does not require a guard, because it does not yield any
- new information about the lifetime of a pointer.</p>
- <h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
- <p>Panics if <code>ord</code> is <code>Acquire</code> or <code>AcqRel</code>.</p>
- </div><h4 id='method.cas' class="method"><span id='cas.v' class='invisible'><code>pub fn <a href='#method.cas' class='fnname'>cas</a>(<br> &self, <br> old: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, <br> new: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#126-138' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do a compare-and-set from a <code>Shared</code> to an <code>Owned</code> pointer with the
- given memory ordering.</p>
- <p>As with <code>store</code>, this operation does not require a guard; it produces no new
- lifetime information. The <code>Result</code> indicates whether the CAS succeeded; if
- not, ownership of the <code>new</code> pointer is returned to the caller.</p>
- </div><h4 id='method.cas_and_ref' class="method"><span id='cas_and_ref.v' class='invisible'><code>pub fn <a href='#method.cas_and_ref' class='fnname'>cas_and_ref</a><'a>(<br> &self, <br> old: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, <br> new: <a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, <br> _: &'a <a class="struct" href="../../crossbeam/epoch/struct.Guard.html" title="struct crossbeam::epoch::Guard">Guard</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><'a, T>, <a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#145-156' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do a compare-and-set from a <code>Shared</code> to an <code>Owned</code> pointer with the
- given memory ordering, immediatley acquiring a new <code>Shared</code> reference to
- the previously-owned pointer if successful.</p>
- <p>This operation is analogous to <code>store_and_ref</code>.</p>
- </div><h4 id='method.cas_shared' class="method"><span id='cas_shared.v' class='invisible'><code>pub fn <a href='#method.cas_shared' class='fnname'>cas_shared</a>(<br> &self, <br> old: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, <br> new: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a><br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#162-168' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do a compare-and-set from a <code>Shared</code> to another <code>Shared</code> pointer with
- the given memory ordering.</p>
- <p>The boolean return value is <code>true</code> when the CAS is successful.</p>
- </div><h4 id='method.swap' class="method"><span id='swap.v' class='invisible'><code>pub fn <a href='#method.swap' class='fnname'>swap</a><'a>(<br> &self, <br> new: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Owned.html" title="struct crossbeam::epoch::Owned">Owned</a><T>>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, <br> _: &'a <a class="struct" href="../../crossbeam/epoch/struct.Guard.html" title="struct crossbeam::epoch::Guard">Guard</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><'a, T>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#171-174' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic swap with an <code>Owned</code> pointer with the given memory ordering.</p>
- </div><h4 id='method.swap_shared' class="method"><span id='swap_shared.v' class='invisible'><code>pub fn <a href='#method.swap_shared' class='fnname'>swap_shared</a><'a>(<br> &self, <br> new: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><T>>, <br> ord: <a class="enum" href="https://doc.rust-lang.org/nightly/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, <br> _: &'a <a class="struct" href="../../crossbeam/epoch/struct.Guard.html" title="struct crossbeam::epoch::Guard">Guard</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../crossbeam/epoch/struct.Shared.html" title="struct crossbeam::epoch::Shared">Shared</a><'a, T>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#177-180' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Do an atomic swap with a <code>Shared</code> pointer with the given memory ordering.</p>
- </div></div>
- <h2 id='implementations' class='small-section-header'>
- Trait Implementations<a href='#implementations' class='anchor'></a>
- </h2>
- <h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#12' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#12' title='goto source code'>[src]</a></span></h4>
- <div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
- </div></div><h3 id='impl-Send' class='impl'><span class='in-band'><code>impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code><a href='#impl-Send' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#18' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><code>impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../crossbeam/epoch/struct.Atomic.html" title="struct crossbeam::epoch::Atomic">Atomic</a><T></code><a href='#impl-Sync' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/crossbeam/epoch/atomic.rs.html#19' title='goto source code'>[src]</a></span></h3>
- <div class='impl-items'></div></section>
- <section id='search' class="content hidden"></section>
- <section class="footer"></section>
- <aside id="help" class="hidden">
- <div>
- <h1 class="hidden">Help</h1>
- <div class="shortcuts">
- <h2>Keyboard Shortcuts</h2>
- <dl>
- <dt><kbd>?</kbd></dt>
- <dd>Show this help dialog</dd>
- <dt><kbd>S</kbd></dt>
- <dd>Focus the search field</dd>
- <dt><kbd>↑</kbd></dt>
- <dd>Move up in search results</dd>
- <dt><kbd>↓</kbd></dt>
- <dd>Move down in search results</dd>
- <dt><kbd>↹</kbd></dt>
- <dd>Switch tab</dd>
- <dt><kbd>⏎</kbd></dt>
- <dd>Go to active search result</dd>
- <dt><kbd>+</kbd></dt>
- <dd>Expand all sections</dd>
- <dt><kbd>-</kbd></dt>
- <dd>Collapse all sections</dd>
- </dl>
- </div>
- <div class="infos">
- <h2>Search Tricks</h2>
- <p>
- Prefix searches with a type followed by a colon (e.g.
- <code>fn:</code>) to restrict the search to a given type.
- </p>
- <p>
- Accepted types are: <code>fn</code>, <code>mod</code>,
- <code>struct</code>, <code>enum</code>,
- <code>trait</code>, <code>type</code>, <code>macro</code>,
- and <code>const</code>.
- </p>
- <p>
- Search functions by type signature (e.g.
- <code>vec -> usize</code> or <code>* -> vec</code>)
- </p>
- </div>
- </div>
- </aside>
-
- <script>
- window.rootPath = "../../";
- window.currentCrate = "crossbeam";
- </script>
- <script src="../../main.js"></script>
- <script defer src="../../search-index.js"></script>
- </body>
- </html>
|