27 lines
5.7 KiB
HTML
27 lines
5.7 KiB
HTML
<!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="Removes all threads from the queue associated with `key_from`, optionally unparks the first one and requeues the rest onto the queue associated with `key_to`."><title>unpark_requeue in parking_lot_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="parking_lot_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../parking_lot_core/index.html">parking_<wbr>lot_<wbr>core</a><span class="version">0.9.10</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">unpark_<wbr>requeue</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate parking_<wbr>lot_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">parking_lot_core</a></span><h1>Function <span class="fn">unpark_requeue</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/parking_lot_core/parking_lot.rs.html#888-991">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn unpark_requeue(
|
|
key_from: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>,
|
|
key_to: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>,
|
|
validate: impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -> <a class="enum" href="enum.RequeueOp.html" title="enum parking_lot_core::RequeueOp">RequeueOp</a>,
|
|
callback: impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="enum.RequeueOp.html" title="enum parking_lot_core::RequeueOp">RequeueOp</a>, <a class="struct" href="struct.UnparkResult.html" title="struct parking_lot_core::UnparkResult">UnparkResult</a>) -> <a class="struct" href="struct.UnparkToken.html" title="struct parking_lot_core::UnparkToken">UnparkToken</a>,
|
|
) -> <a class="struct" href="struct.UnparkResult.html" title="struct parking_lot_core::UnparkResult">UnparkResult</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Removes all threads from the queue associated with <code>key_from</code>, optionally
|
|
unparks the first one and requeues the rest onto the queue associated with
|
|
<code>key_to</code>.</p>
|
|
<p>The <code>validate</code> function is called while both queues are locked. Its return
|
|
value will determine which operation is performed, or whether the operation
|
|
should be aborted. See <code>RequeueOp</code> for details about the different possible
|
|
return values.</p>
|
|
<p>The <code>callback</code> function is also called while both queues are locked. It is
|
|
passed the <code>RequeueOp</code> returned by <code>validate</code> and an <code>UnparkResult</code>
|
|
indicating whether a thread was unparked and whether there are threads still
|
|
parked in the new queue. This <code>UnparkResult</code> value is also returned by
|
|
<code>unpark_requeue</code>.</p>
|
|
<p>The <code>callback</code> function should return an <code>UnparkToken</code> value which will be
|
|
passed to the thread that is unparked. If no thread is unparked then the
|
|
returned value is ignored.</p>
|
|
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
|
<p>You should only call this function with an address that you control, since
|
|
you could otherwise interfere with the operation of other synchronization
|
|
primitives.</p>
|
|
<p>The <code>validate</code> and <code>callback</code> functions are called while the queue is locked
|
|
and must not panic or call into any function in <code>parking_lot</code>.</p>
|
|
</div></details></section></div></main></body></html> |