index.html 8.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!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 `chase_lev` mod in crate `crossbeam`."><meta name="keywords" content="rust, rustlang, rust-lang, chase_lev"><title>crossbeam::sync::chase_lev - 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="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script></head><body class="rustdoc mod"><!--[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">&#9776;</div><p class='location'>Module chase_lev</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../../index.html'>crossbeam</a>::<wbr><a href='../index.html'>sync</a></p><script>window.sidebarCurrent = {name: 'chase_lev', ty: 'mod', 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"><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Module <a href='../../index.html'>crossbeam</a>::<wbr><a href='../index.html'>sync</a>::<wbr><a class="mod" href=''>chase_lev</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'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/crossbeam/sync/chase_lev.rs.html#11-605' title='goto source code'>[src]</a></span></h1><div class='docblock'><p>A lock-free concurrent work-stealing deque</p>
  2. <p>This module contains a hybrid implementation of the Chase-Lev work stealing deque
  3. described in <a href="http://neteril.org/%7Ejeremie/Dynamic_Circular_Work_Queue.pdf">&quot;Dynamic Circular Work-Stealing Deque&quot;</a> and the improved version
  4. described in <a href="http://www.di.ens.fr/%7Ezappa/readings/ppopp13.pdf">&quot;Correct and Efficient Work-Stealing for Weak Memory Models&quot;</a>.
  5. The implementation is heavily based on the pseudocode found in the papers.</p>
  6. <h1 id="example" class="section-header"><a href="#example">Example</a></h1>
  7. <pre class="rust rust-example-rendered">
  8. <span class="kw">use</span> <span class="ident">crossbeam</span>::<span class="ident">sync</span>::<span class="ident">chase_lev</span>;
  9. <span class="kw">let</span> (<span class="ident">worker</span>, <span class="ident">stealer</span>) <span class="op">=</span> <span class="ident">chase_lev</span>::<span class="ident">deque</span>();
  10. <span class="comment">// Only the worker may push/try_pop</span>
  11. <span class="ident">worker</span>.<span class="ident">push</span>(<span class="number">1</span>);
  12. <span class="ident">worker</span>.<span class="ident">try_pop</span>();
  13. <span class="comment">// Stealers take data from the other end of the deque</span>
  14. <span class="ident">worker</span>.<span class="ident">push</span>(<span class="number">1</span>);
  15. <span class="ident">stealer</span>.<span class="ident">steal</span>();
  16. <span class="comment">// Stealers can be cloned to have many stealers stealing in parallel</span>
  17. <span class="ident">worker</span>.<span class="ident">push</span>(<span class="number">1</span>);
  18. <span class="kw">let</span> <span class="ident">stealer2</span> <span class="op">=</span> <span class="ident">stealer</span>.<span class="ident">clone</span>();
  19. <span class="ident">stealer2</span>.<span class="ident">steal</span>();</pre>
  20. </div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
  21. <table>
  22. <tr class=' module-item'>
  23. <td><a class="struct" href="struct.Stealer.html"
  24. title='struct crossbeam::sync::chase_lev::Stealer'>Stealer</a></td>
  25. <td class='docblock-short'>
  26. <p>The stealing half of the work-stealing deque. Stealers have access to the
  27. opposite end of the deque from the worker, and they only have access to the
  28. <code>steal</code> method.</p>
  29. </td>
  30. </tr>
  31. <tr class=' module-item'>
  32. <td><a class="struct" href="struct.Worker.html"
  33. title='struct crossbeam::sync::chase_lev::Worker'>Worker</a></td>
  34. <td class='docblock-short'>
  35. <p>Worker half of the work-stealing deque. This worker has exclusive access to
  36. one side of the deque, and uses <code>push</code> and <code>try_pop</code> method to manipulate it.</p>
  37. </td>
  38. </tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
  39. <table>
  40. <tr class=' module-item'>
  41. <td><a class="enum" href="enum.Steal.html"
  42. title='enum crossbeam::sync::chase_lev::Steal'>Steal</a></td>
  43. <td class='docblock-short'>
  44. <p>When stealing some data, this is an enumeration of the possible outcomes.</p>
  45. </td>
  46. </tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
  47. <table>
  48. <tr class=' module-item'>
  49. <td><a class="fn" href="fn.deque.html"
  50. title='fn crossbeam::sync::chase_lev::deque'>deque</a></td>
  51. <td class='docblock-short'>
  52. <p>Creates a new empty deque</p>
  53. </td>
  54. </tr></table></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>&#9166;</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><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../../";window.currentCrate = "crossbeam";</script><script src="../../../aliases.js"></script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>