nim-chronos/api/chronos/asyncsync.html

1192 lines
141 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- CSS -->
<title>chronos/asyncsync</title>
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<script type="text/javascript" src="../dochack.js"></script>
<script type="text/javascript">
function main() {
var pragmaDots = document.getElementsByClassName("pragmadots");
for (var i = 0; i < pragmaDots.length; i++) {
pragmaDots[i].onclick = function(event) {
// Hide tease
event.target.parentNode.style.display = "none";
// Show actual
event.target.parentNode.nextElementSibling.style.display = "inline";
}
}
function switchTheme(e) {
if (e.target.checked) {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
}
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
if (toggleSwitch !== null) {
toggleSwitch.addEventListener('change', switchTheme, false);
}
var currentTheme = localStorage.getItem('theme');
if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) {
currentTheme = 'dark';
}
if (currentTheme) {
document.documentElement.setAttribute('data-theme', currentTheme);
if (currentTheme === 'dark' && toggleSwitch !== null) {
toggleSwitch.checked = true;
}
}
}
window.addEventListener('DOMContentLoaded', main);
</script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">chronos/asyncsync</h1>
<div class="row">
<div class="three columns">
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Dark Mode</em>
</div>
<div id="global-links">
<ul class="simple">
<li>
<a href="../theindex.html">Index</a>
</li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="text" id="searchInput"
onkeyup="search()" />
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
<ul class="simple simple-toc-section">
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncEvent"
title="AsyncEvent = ref object of RootRef
flag: bool
waiters: seq[Future[void].Raising([CancelledError])]">AsyncEvent</a></li>
<li><a class="reference" href="#AsyncEventQueue"
title="AsyncEventQueue[T] = ref object of RootObj
readers: seq[EventQueueReader]
queue: Deque[T]
counter: uint64
limit: int
offset: int">AsyncEventQueue</a></li>
<li><a class="reference" href="#AsyncEventQueueFullError"
title="AsyncEventQueueFullError = object of AsyncError">AsyncEventQueueFullError</a></li>
<li><a class="reference" href="#AsyncLock"
title="AsyncLock = ref object of RootRef
locked: bool
acquired: bool
waiters: seq[Future[void].Raising([CancelledError])]">AsyncLock</a></li>
<li><a class="reference" href="#AsyncLockError"
title="AsyncLockError = object of AsyncError">AsyncLockError</a></li>
<li><a class="reference" href="#AsyncQueue"
title="AsyncQueue[T] = ref object of RootRef
getters: seq[Future[void].Raising([CancelledError])]
putters: seq[Future[void].Raising([CancelledError])]
queue: Deque[T]
maxsize: int">AsyncQueue</a></li>
<li><a class="reference" href="#AsyncQueueEmptyError"
title="AsyncQueueEmptyError = object of AsyncError">AsyncQueueEmptyError</a></li>
<li><a class="reference" href="#AsyncQueueFullError"
title="AsyncQueueFullError = object of AsyncError">AsyncQueueFullError</a></li>
<li><a class="reference" href="#EventQueueKey"
title="EventQueueKey = distinct uint64">EventQueueKey</a></li>
<li><a class="reference" href="#EventQueueReader"
title="EventQueueReader = object
key: EventQueueKey
offset: int
waiter: Future[void].Raising([CancelledError])
overflow: bool">EventQueueReader</a></li>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CAsyncQueue%5BT%5D"
title="`$`[T](aq: AsyncQueue[T]): string">`$`[T](aq: AsyncQueue[T]): string</a></li>
</ul>
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CAsyncQueue%5BT%5D%2CBackwardsIndex"
title="`[]`[T](aq: AsyncQueue[T]; i: BackwardsIndex): T">`[]`[T](aq: AsyncQueue[T]; i: BackwardsIndex): T</a></li>
<li><a class="reference" href="#%5B%5D%2CAsyncQueue%5BT%5D%2CNatural"
title="`[]`[T](aq: AsyncQueue[T]; i: Natural): T">`[]`[T](aq: AsyncQueue[T]; i: Natural): T</a></li>
</ul>
<ul class="simple nested-toc-section">[]=
<li><a class="reference" href="#%5B%5D%3D%2CAsyncQueue%5BT%5D%2CBackwardsIndex%2CT"
title="`[]=`[T](aq: AsyncQueue[T]; i: BackwardsIndex; item: T)">`[]=`[T](aq: AsyncQueue[T]; i: BackwardsIndex; item: T)</a></li>
<li><a class="reference" href="#%5B%5D%3D%2CAsyncQueue%5BT%5D%2CNatural%2CT"
title="`[]=`[T](aq: AsyncQueue[T]; i: Natural; item: T)">`[]=`[T](aq: AsyncQueue[T]; i: Natural; item: T)</a></li>
</ul>
<ul class="simple nested-toc-section">acquire
<li><a class="reference" href="#acquire%2CAsyncLock"
title="acquire(lock: AsyncLock): InternalRaisesFuture[void, (CancelledError,)]">acquire(lock: AsyncLock): InternalRaisesFuture[void, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">addFirst
<li><a class="reference" href="#addFirst%2CAsyncQueue%5BT%5D%2CT"
title="addFirst[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,
(CancelledError,)]">addFirst[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,
(CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">addFirstNoWait
<li><a class="reference" href="#addFirstNoWait%2CAsyncQueue%5BT%5D%2CT"
title="addFirstNoWait[T](aq: AsyncQueue[T]; item: T)">addFirstNoWait[T](aq: AsyncQueue[T]; item: T)</a></li>
</ul>
<ul class="simple nested-toc-section">addLast
<li><a class="reference" href="#addLast%2CAsyncQueue%5BT%5D%2CT"
title="addLast[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,
(CancelledError,)]">addLast[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,
(CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">addLastNoWait
<li><a class="reference" href="#addLastNoWait%2CAsyncQueue%5BT%5D%2CT"
title="addLastNoWait[T](aq: AsyncQueue[T]; item: T)">addLastNoWait[T](aq: AsyncQueue[T]; item: T)</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CAsyncEvent"
title="clear(event: AsyncEvent)">clear(event: AsyncEvent)</a></li>
<li><a class="reference" href="#clear%2CAsyncQueue%5BT%5D"
title="clear[T](aq: AsyncQueue[T])">clear[T](aq: AsyncQueue[T])</a></li>
</ul>
<ul class="simple nested-toc-section">close
<li><a class="reference" href="#close%2CAsyncEventQueue"
title="close(ab: AsyncEventQueue)">close(ab: AsyncEventQueue)</a></li>
</ul>
<ul class="simple nested-toc-section">closeWait
<li><a class="reference" href="#closeWait%2CAsyncEventQueue"
title="closeWait(ab: AsyncEventQueue): InternalRaisesFuture[void, void]">closeWait(ab: AsyncEventQueue): InternalRaisesFuture[void, void]</a></li>
</ul>
<ul class="simple nested-toc-section">contains
<li><a class="reference" href="#contains%2CAsyncQueue%5BT%5D%2CT"
title="contains[T](aq: AsyncQueue[T]; item: T): bool">contains[T](aq: AsyncQueue[T]; item: T): bool</a></li>
</ul>
<ul class="simple nested-toc-section">emit
<li><a class="reference" href="#emit%2CAsyncEventQueue%5BT%5D%2CT"
title="emit[T](ab: AsyncEventQueue[T]; data: T)">emit[T](ab: AsyncEventQueue[T]; data: T)</a></li>
</ul>
<ul class="simple nested-toc-section">empty
<li><a class="reference" href="#empty%2CAsyncQueue%5BT%5D"
title="empty[T](aq: AsyncQueue[T]): bool">empty[T](aq: AsyncQueue[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">fire
<li><a class="reference" href="#fire%2CAsyncEvent"
title="fire(event: AsyncEvent)">fire(event: AsyncEvent)</a></li>
</ul>
<ul class="simple nested-toc-section">full
<li><a class="reference" href="#full%2CAsyncQueue%5BT%5D"
title="full[T](aq: AsyncQueue[T]): bool">full[T](aq: AsyncQueue[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">get
<li><a class="reference" href="#get%2CAsyncQueue%5BT%5D"
title="get[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]">get[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">getNoWait
<li><a class="reference" href="#getNoWait%2CAsyncQueue%5BT%5D"
title="getNoWait[T](aq: AsyncQueue[T]): T">getNoWait[T](aq: AsyncQueue[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">isSet
<li><a class="reference" href="#isSet%2CAsyncEvent"
title="isSet(event: AsyncEvent): bool">isSet(event: AsyncEvent): bool</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CAsyncEventQueue"
title="len(ab: AsyncEventQueue): int">len(ab: AsyncEventQueue): int</a></li>
<li><a class="reference" href="#len%2CAsyncQueue%5BT%5D"
title="len[T](aq: AsyncQueue[T]): int">len[T](aq: AsyncQueue[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">locked
<li><a class="reference" href="#locked%2CAsyncLock"
title="locked(lock: AsyncLock): bool">locked(lock: AsyncLock): bool</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncEvent
<li><a class="reference" href="#newAsyncEvent"
title="newAsyncEvent(): AsyncEvent">newAsyncEvent(): AsyncEvent</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncEventQueue
<li><a class="reference" href="#newAsyncEventQueue%2Cint"
title="newAsyncEventQueue[T](limitSize = 0): AsyncEventQueue[T]">newAsyncEventQueue[T](limitSize = 0): AsyncEventQueue[T]</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncLock
<li><a class="reference" href="#newAsyncLock"
title="newAsyncLock(): AsyncLock">newAsyncLock(): AsyncLock</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncQueue
<li><a class="reference" href="#newAsyncQueue%2Cint"
title="newAsyncQueue[T](maxsize: int = 0): AsyncQueue[T]">newAsyncQueue[T](maxsize: int = 0): AsyncQueue[T]</a></li>
</ul>
<ul class="simple nested-toc-section">popFirst
<li><a class="reference" href="#popFirst%2CAsyncQueue%5BT%5D"
title="popFirst[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]">popFirst[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">popFirstNoWait
<li><a class="reference" href="#popFirstNoWait%2CAsyncQueue%5BT%5D"
title="popFirstNoWait[T](aq: AsyncQueue[T]): T">popFirstNoWait[T](aq: AsyncQueue[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">popLast
<li><a class="reference" href="#popLast%2CAsyncQueue%5BT%5D"
title="popLast[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]">popLast[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">popLastNoWait
<li><a class="reference" href="#popLastNoWait%2CAsyncQueue%5BT%5D"
title="popLastNoWait[T](aq: AsyncQueue[T]): T">popLastNoWait[T](aq: AsyncQueue[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">put
<li><a class="reference" href="#put%2CAsyncQueue%5BT%5D%2CT"
title="put[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void, (CancelledError,)]">put[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">putNoWait
<li><a class="reference" href="#putNoWait%2CAsyncQueue%5BT%5D%2CT"
title="putNoWait[T](aq: AsyncQueue[T]; item: T)">putNoWait[T](aq: AsyncQueue[T]; item: T)</a></li>
</ul>
<ul class="simple nested-toc-section">register
<li><a class="reference" href="#register%2CAsyncEventQueue"
title="register(ab: AsyncEventQueue): EventQueueKey">register(ab: AsyncEventQueue): EventQueueKey</a></li>
</ul>
<ul class="simple nested-toc-section">release
<li><a class="reference" href="#release%2CAsyncLock"
title="release(lock: AsyncLock)">release(lock: AsyncLock)</a></li>
</ul>
<ul class="simple nested-toc-section">size
<li><a class="reference" href="#size%2CAsyncQueue%5BT%5D"
title="size[T](aq: AsyncQueue[T]): int">size[T](aq: AsyncQueue[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">unregister
<li><a class="reference" href="#unregister%2CAsyncEventQueue%2CEventQueueKey"
title="unregister(ab: AsyncEventQueue; key: EventQueueKey)">unregister(ab: AsyncEventQueue; key: EventQueueKey)</a></li>
</ul>
<ul class="simple nested-toc-section">wait
<li><a class="reference" href="#wait%2CAsyncEvent"
title="wait(event: AsyncEvent): InternalRaisesFuture[void, (CancelledError,)]">wait(event: AsyncEvent): InternalRaisesFuture[void, (CancelledError,)]</a></li>
</ul>
<ul class="simple nested-toc-section">waitEvents
<li><a class="reference" href="#waitEvents%2CAsyncEventQueue%5BT%5D%2CEventQueueKey%2Cint"
title="waitEvents[T](ab: AsyncEventQueue[T]; key: EventQueueKey; eventsCount = -1): InternalRaisesFuture[
seq[T], (AsyncEventQueueFullError, CancelledError)]">waitEvents[T](ab: AsyncEventQueue[T]; key: EventQueueKey; eventsCount = -1): InternalRaisesFuture[
seq[T], (AsyncEventQueueFullError, CancelledError)]</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#15" id="65">Iterators</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">items
<li><a class="reference" href="#items.i%2CAsyncQueue%5BT%5D"
title="items[T](aq: AsyncQueue[T]): T">items[T](aq: AsyncQueue[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">mitems
<li><a class="reference" href="#mitems.i%2CAsyncQueue%5BT%5D"
title="mitems[T](aq: AsyncQueue[T]): var T">mitems[T](aq: AsyncQueue[T]): var T</a></li>
</ul>
<ul class="simple nested-toc-section">pairs
<li><a class="reference" href="#pairs.i%2CAsyncQueue%5BT%5D"
title="pairs[T](aq: AsyncQueue[T]): tuple[key: int, val: T]">pairs[T](aq: AsyncQueue[T]): tuple[key: int, val: T]</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#18" id="68">Templates</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">readerOverflow
<li><a class="reference" href="#readerOverflow.t%2CAsyncEventQueue%2CEventQueueReader"
title="readerOverflow(ab: AsyncEventQueue; reader: EventQueueReader): bool">readerOverflow(ab: AsyncEventQueue; reader: EventQueueReader): bool</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
<ul class="simple simple-toc-section">
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc">This module implements some core synchronization primitives.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="asyncloop.html">asyncloop</a>
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncEvent">
<dt><pre><a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootRef</span>
<span class="Identifier">flag</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">waiters</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Identifier">CancelledError</span><span class="Other">]</span><span class="Other">)</span><span class="Other">]</span>
</pre></dt>
<dd>
<p>A primitive event object.</p>
<p>An event manages a flag that can be set to <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> with the <tt class="docutils literal"><span class="pre">fire()</span></tt> procedure and reset to <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> with the <tt class="docutils literal"><span class="pre">clear()</span></tt> procedure. The <tt class="docutils literal"><span class="pre">wait()</span></tt> coroutine blocks until the flag is <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
<p>If more than one coroutine blocked in <tt class="docutils literal"><span class="pre">wait()</span></tt> waiting for event state to be signaled, when event get fired, then all coroutines continue proceeds in order, they have entered waiting state.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L33"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L33" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncEventQueue">
<dt><pre><a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">readers</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="asyncsync.html#EventQueueReader"><span class="Identifier">EventQueueReader</span></a><span class="Other">]</span>
<span class="Identifier">queue</span><span class="Other">:</span> <span class="Identifier">Deque</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span>
<span class="Identifier">counter</span><span class="Other">:</span> <span class="Identifier">uint64</span>
<span class="Identifier">limit</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">offset</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L75"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L75" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncEventQueueFullError">
<dt><pre><a href="asyncsync.html#AsyncEventQueueFullError"><span class="Identifier">AsyncEventQueueFullError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="internal/errors.html#AsyncError"><span class="Identifier">AsyncError</span></a></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L65"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L65" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncLock">
<dt><pre><a href="asyncsync.html#AsyncLock"><span class="Identifier">AsyncLock</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootRef</span>
<span class="Identifier">locked</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">acquired</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">waiters</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Identifier">CancelledError</span><span class="Other">]</span><span class="Other">)</span><span class="Other">]</span>
</pre></dt>
<dd>
<p>A primitive lock is a synchronization primitive that is not owned by a particular coroutine when locked. A primitive lock is in one of two states, <tt class="docutils literal"><span class="pre">locked</span></tt> or <tt class="docutils literal"><span class="pre">unlocked</span></tt>.</p>
<p>When more than one coroutine is blocked in <tt class="docutils literal"><span class="pre">acquire()</span></tt> waiting for the state to turn to unlocked, only one coroutine proceeds when a <tt class="docutils literal"><span class="pre">release()</span></tt> call resets the state to unlocked; first coroutine which is blocked in <tt class="docutils literal"><span class="pre">acquire()</span></tt> is being processed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L20"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L20" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncLockError">
<dt><pre><a href="asyncsync.html#AsyncLockError"><span class="Identifier">AsyncLockError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="internal/errors.html#AsyncError"><span class="Identifier">AsyncError</span></a>
</pre></dt>
<dd>
<tt class="docutils literal"><span class="pre">AsyncLock</span></tt> is either locked or unlocked.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L62"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L62" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncQueue">
<dt><pre><a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootRef</span>
<span class="Identifier">getters</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Identifier">CancelledError</span><span class="Other">]</span><span class="Other">)</span><span class="Other">]</span>
<span class="Identifier">putters</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Identifier">CancelledError</span><span class="Other">]</span><span class="Other">)</span><span class="Other">]</span>
<span class="Identifier">queue</span><span class="Other">:</span> <span class="Identifier">Deque</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span>
<span class="Identifier">maxsize</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
<p>A queue, useful for coordinating producer and consumer coroutines.</p>
<p>If <tt class="docutils literal"><span class="pre">maxsize</span></tt> is less than or equal to zero, the queue size is infinite. If it is an integer greater than <tt class="docutils literal"><span class="pre">0</span></tt>, then &quot;await put()&quot; will block when the queue reaches <tt class="docutils literal"><span class="pre">maxsize</span></tt>, until an item is removed by &quot;await get()&quot;.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L46"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L46" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncQueueEmptyError">
<dt><pre><a href="asyncsync.html#AsyncQueueEmptyError"><span class="Identifier">AsyncQueueEmptyError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="internal/errors.html#AsyncError"><span class="Identifier">AsyncError</span></a>
</pre></dt>
<dd>
<tt class="docutils literal"><span class="pre">AsyncQueue</span></tt> is empty.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L58"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L58" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncQueueFullError">
<dt><pre><a href="asyncsync.html#AsyncQueueFullError"><span class="Identifier">AsyncQueueFullError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="internal/errors.html#AsyncError"><span class="Identifier">AsyncError</span></a>
</pre></dt>
<dd>
<tt class="docutils literal"><span class="pre">AsyncQueue</span></tt> is full.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L60"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L60" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="EventQueueKey">
<dt><pre><a href="asyncsync.html#EventQueueKey"><span class="Identifier">EventQueueKey</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">uint64</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L67"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L67" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="EventQueueReader">
<dt><pre><a href="asyncsync.html#EventQueueReader"><span class="Identifier">EventQueueReader</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">key</span><span class="Other">:</span> <a href="asyncsync.html#EventQueueKey"><span class="Identifier">EventQueueKey</span></a>
<span class="Identifier">offset</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">waiter</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">.</span><span class="Identifier">Raising</span><span class="Other">(</span><span class="Other">[</span><span class="Identifier">CancelledError</span><span class="Other">]</span><span class="Other">)</span>
<span class="Identifier">overflow</span><span class="Other">:</span> <span class="Identifier">bool</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L69"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L69" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CAsyncQueue%5BT%5D"><span class="Identifier">`$`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Turn an async queue <tt class="docutils literal"><span class="pre">aq</span></tt> into its string representation.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L432"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L432" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="[]=,AsyncQueue[T],BackwardsIndex,T">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CAsyncQueue%5BT%5D%2CBackwardsIndex%2CT"><span class="Identifier">`[]=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">BackwardsIndex</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Change the i-th element of <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L406"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L406" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="[]=,AsyncQueue[T],Natural,T">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CAsyncQueue%5BT%5D%2CNatural%2CT"><span class="Identifier">`[]=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">Natural</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Change the i-th element of <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L402"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L402" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="[],AsyncQueue[T],BackwardsIndex">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CAsyncQueue%5BT%5D%2CBackwardsIndex"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">BackwardsIndex</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Access the i-th element of <tt class="docutils literal"><span class="pre">aq</span></tt> by order from first to last. <tt class="docutils literal"><span class="pre">aq[0]</span></tt> is the first element, <tt class="docutils literal"><span class="pre">aq[^1]</span></tt> is the last element.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L397"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L397" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="[],AsyncQueue[T],Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CAsyncQueue%5BT%5D%2CNatural"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">Natural</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Access the i-th element of <tt class="docutils literal"><span class="pre">aq</span></tt> by order from first to last. <tt class="docutils literal"><span class="pre">aq[0]</span></tt> is the first element, <tt class="docutils literal"><span class="pre">aq[^1]</span></tt> is the last element.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L392"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L392" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="acquire,AsyncLock">
<dt><pre><span class="Keyword">proc</span> <a href="#acquire%2CAsyncLock"><span class="Identifier">acquire</span></a><span class="Other">(</span><span class="Identifier">lock</span><span class="Other">:</span> <a href="asyncsync.html#AsyncLock"><span class="Identifier">AsyncLock</span></a><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Acquire a lock <tt class="docutils literal"><span class="pre">lock</span></tt>.</p>
<p>This procedure blocks until the lock <tt class="docutils literal"><span class="pre">lock</span></tt> is unlocked, then sets it to locked and returns.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L120"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L120" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="addFirst,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#addFirst%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">addFirst</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Put an <tt class="docutils literal"><span class="pre">item</span></tt> to the beginning of the queue <tt class="docutils literal"><span class="pre">aq</span></tt>. If the queue is full, wait until a free slot is available before adding item.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L297"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L297" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="addFirstNoWait,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#addFirstNoWait%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">addFirstNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueFullError"><span class="Identifier">AsyncQueueFullError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Put an item <tt class="docutils literal"><span class="pre">item</span></tt> to the beginning of the queue <tt class="docutils literal"><span class="pre">aq</span></tt> immediately.</p>
<p>If queue <tt class="docutils literal"><span class="pre">aq</span></tt> is full, then <tt class="docutils literal"><span class="pre">AsyncQueueFullError</span></tt> exception raised.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L260"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L260" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="addLast,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#addLast%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">addLast</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Put an <tt class="docutils literal"><span class="pre">item</span></tt> to the end of the queue <tt class="docutils literal"><span class="pre">aq</span></tt>. If the queue is full, wait until a free slot is available before adding item.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L313"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L313" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="addLastNoWait,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#addLastNoWait%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">addLastNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueFullError"><span class="Identifier">AsyncQueueFullError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Put an item <tt class="docutils literal"><span class="pre">item</span></tt> at the end of the queue <tt class="docutils literal"><span class="pre">aq</span></tt> immediately.</p>
<p>If queue <tt class="docutils literal"><span class="pre">aq</span></tt> is full, then <tt class="docutils literal"><span class="pre">AsyncQueueFullError</span></tt> exception raised.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L269"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L269" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="clear,AsyncEvent">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CAsyncEvent"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">event</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reset the internal flag of <tt class="docutils literal"><span class="pre">event</span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>. Subsequently, tasks calling <tt class="docutils literal"><span class="pre"><span class="Identifier">wait</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> will block until <tt class="docutils literal"><span class="pre"><span class="Identifier">fire</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is called to set the internal flag to <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> again.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L194"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L194" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="clear,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CAsyncQueue%5BT%5D"><span class="Identifier">clear</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Clears all elements of queue <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L380"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L380" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="close,AsyncEventQueue">
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CAsyncEventQueue"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L513"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L513" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="closeWait,AsyncEventQueue">
<dt><pre><span class="Keyword">proc</span> <a href="#closeWait%2CAsyncEventQueue"><span class="Identifier">closeWait</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L521"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L521" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="contains,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#contains%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">contains</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return true if <tt class="docutils literal"><span class="pre">item</span></tt> is in <tt class="docutils literal"><span class="pre">aq</span></tt> or false if not found. Usually used via the <tt class="docutils literal"><span class="pre">in</span></tt> operator.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L425"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L425" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="emit,AsyncEventQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#emit%2CAsyncEventQueue%5BT%5D%2CT"><span class="Identifier">emit</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L540"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L540" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="empty,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#empty%2CAsyncQueue%5BT%5D"><span class="Identifier">empty</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return <tt class="docutils literal"><span class="pre">true</span></tt> if the queue is empty, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L238"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L238" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="fire,AsyncEvent">
<dt><pre><span class="Keyword">proc</span> <a href="#fire%2CAsyncEvent"><span class="Identifier">fire</span></a><span class="Other">(</span><span class="Identifier">event</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Set the internal flag of <tt class="docutils literal"><span class="pre">event</span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt>. All tasks waiting for it to become <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> are awakened. Task that call <tt class="docutils literal"><span class="pre"><span class="Identifier">wait</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> once the flag is <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> will not block at all.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L183"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L183" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="full,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#full%2CAsyncQueue%5BT%5D"><span class="Identifier">full</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if there are <tt class="docutils literal"><span class="pre">maxsize</span></tt> items in the queue.</p>
<p>Note: If the <tt class="docutils literal"><span class="pre">aq</span></tt> was initialized with <tt class="docutils literal"><span class="pre">maxsize = 0</span></tt> (default), then <tt class="docutils literal"><span class="pre">full()</span></tt> is never <tt class="docutils literal"><span class="pre">true</span></tt>.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L228"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L228" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="get,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#get%2CAsyncQueue%5BT%5D"><span class="Identifier">get</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L376"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L376" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getNoWait,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#getNoWait%2CAsyncQueue%5BT%5D"><span class="Identifier">getNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueEmptyError"><span class="Identifier">AsyncQueueEmptyError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Alias of <tt class="docutils literal"><span class="pre">popFirstNoWait()</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L365"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L365" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="isSet,AsyncEvent">
<dt><pre><span class="Keyword">proc</span> <a href="#isSet%2CAsyncEvent"><span class="Identifier">isSet</span></a><span class="Other">(</span><span class="Identifier">event</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> if and only if the internal flag of <tt class="docutils literal"><span class="pre">event</span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L200"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L200" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="len,AsyncEventQueue">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CAsyncEventQueue"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L491"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L491" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="len,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CAsyncQueue%5BT%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return the number of elements in <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L384"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L384" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="locked,AsyncLock">
<dt><pre><span class="Keyword">proc</span> <a href="#locked%2CAsyncLock"><span class="Identifier">locked</span></a><span class="Other">(</span><span class="Identifier">lock</span><span class="Other">:</span> <a href="asyncsync.html#AsyncLock"><span class="Identifier">AsyncLock</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> if the lock <tt class="docutils literal"><span class="pre">lock</span></tt> is acquired, <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> otherwise.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L135"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L135" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="newAsyncEvent">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncEvent"><span class="Identifier">newAsyncEvent</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates new asyncronous event <tt class="docutils literal"><span class="pre">AsyncEvent</span></tt>.</p>
<p>An event manages a flag that can be set to <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> with the <tt class="docutils literal"><span class="pre"><span class="Identifier">fire</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> procedure and reset to <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> with the <tt class="docutils literal"><span class="pre"><span class="Identifier">clear</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> procedure. The <tt class="docutils literal"><span class="pre"><span class="Identifier">wait</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> procedure blocks until the flag is <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt>. The flag is initially <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L158"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L158" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="newAsyncEventQueue,int">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncEventQueue%2Cint"><span class="Identifier">newAsyncEventQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">limitSize</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates new <tt class="docutils literal"><span class="pre">AsyncEventBus</span></tt> maximum size of <tt class="docutils literal"><span class="pre">limitSize</span></tt> (default is <tt class="docutils literal"><span class="pre">0</span></tt> which means that there no limits).</p>
<p>When number of events emitted exceeds <tt class="docutils literal"><span class="pre">limitSize</span></tt> - emit() procedure will discard new events, consumers which has number of pending events more than <tt class="docutils literal"><span class="pre">limitSize</span></tt> will get <tt class="docutils literal"><span class="pre">AsyncEventQueueFullError</span></tt> error.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L472"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L472" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="newAsyncLock">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncLock"><span class="Identifier">newAsyncLock</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncsync.html#AsyncLock"><span class="Identifier">AsyncLock</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates new asynchronous lock <tt class="docutils literal"><span class="pre">AsyncLock</span></tt>.</p>
<p>Lock is created in the unlocked state. When the state is unlocked, <tt class="docutils literal"><span class="pre">acquire()</span></tt> changes the state to locked and returns immediately. When the state is locked, <tt class="docutils literal"><span class="pre">acquire()</span></tt> blocks until a call to <tt class="docutils literal"><span class="pre">release()</span></tt> in another coroutine changes it to unlocked.</p>
<p>The <tt class="docutils literal"><span class="pre">release()</span></tt> procedure changes the state to unlocked and returns immediately.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L82"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L82" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="newAsyncQueue,int">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncQueue%2Cint"><span class="Identifier">newAsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">maxsize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new asynchronous queue <tt class="docutils literal"><span class="pre">AsyncQueue</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L204"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L204" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="popFirst,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#popFirst%2CAsyncQueue%5BT%5D"><span class="Identifier">popFirst</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Remove and return an <tt class="docutils literal"><span class="pre">item</span></tt> from the beginning of the queue <tt class="docutils literal"><span class="pre">aq</span></tt>. If the queue is empty, wait until an item is available.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L329"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L329" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="popFirstNoWait,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#popFirstNoWait%2CAsyncQueue%5BT%5D"><span class="Identifier">popFirstNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueEmptyError"><span class="Identifier">AsyncQueueEmptyError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Get an item from the beginning of the queue <tt class="docutils literal"><span class="pre">aq</span></tt> immediately.</p>
<p>If queue <tt class="docutils literal"><span class="pre">aq</span></tt> is empty, then <tt class="docutils literal"><span class="pre">AsyncQueueEmptyError</span></tt> exception raised.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L278"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L278" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="popLast,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#popLast%2CAsyncQueue%5BT%5D"><span class="Identifier">popLast</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Remove and return an <tt class="docutils literal"><span class="pre">item</span></tt> from the end of the queue <tt class="docutils literal"><span class="pre">aq</span></tt>. If the queue is empty, wait until an item is available.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L345"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L345" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="popLastNoWait,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#popLastNoWait%2CAsyncQueue%5BT%5D"><span class="Identifier">popLastNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueEmptyError"><span class="Identifier">AsyncQueueEmptyError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Get an item from the end of the queue <tt class="docutils literal"><span class="pre">aq</span></tt> immediately.</p>
<p>If queue <tt class="docutils literal"><span class="pre">aq</span></tt> is empty, then <tt class="docutils literal"><span class="pre">AsyncQueueEmptyError</span></tt> exception raised.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L287"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L287" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="put,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#put%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">put</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L371"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L371" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="putNoWait,AsyncQueue[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#putNoWait%2CAsyncQueue%5BT%5D%2CT"><span class="Identifier">putNoWait</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncQueueFullError"><span class="Identifier">AsyncQueueFullError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Alias of <tt class="docutils literal"><span class="pre">addLastNoWait()</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L360"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L360" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="register,AsyncEventQueue">
<dt><pre><span class="Keyword">proc</span> <a href="#register%2CAsyncEventQueue"><span class="Identifier">register</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncsync.html#EventQueueKey"><span class="Identifier">EventQueueKey</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L494"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L494" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="release,AsyncLock">
<dt><pre><span class="Keyword">proc</span> <a href="#release%2CAsyncLock"><span class="Identifier">release</span></a><span class="Other">(</span><span class="Identifier">lock</span><span class="Other">:</span> <a href="asyncsync.html#AsyncLock"><span class="Identifier">AsyncLock</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="asyncsync.html#AsyncLockError"><span class="Identifier">AsyncLockError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Release a lock <tt class="docutils literal"><span class="pre">lock</span></tt>.</p>
<p>When the <tt class="docutils literal"><span class="pre">lock</span></tt> is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L139"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L139" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="size,AsyncQueue[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#size%2CAsyncQueue%5BT%5D"><span class="Identifier">size</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return the maximum number of elements in <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L388"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L388" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="unregister,AsyncEventQueue,EventQueueKey">
<dt><pre><span class="Keyword">proc</span> <a href="#unregister%2CAsyncEventQueue%2CEventQueueKey"><span class="Identifier">unregister</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="asyncsync.html#EventQueueKey"><span class="Identifier">EventQueueKey</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L502"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L502" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="wait,AsyncEvent">
<dt><pre><span class="Keyword">proc</span> <a href="#wait%2CAsyncEvent"><span class="Identifier">wait</span></a><span class="Other">(</span><span class="Identifier">event</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEvent"><span class="Identifier">AsyncEvent</span></a><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Other">(</span><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">,</span><span class="Other">)</span><span class="Other">]</span> {.
<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L168"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L168" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="waitEvents,AsyncEventQueue[T],EventQueueKey,int">
<dt><pre><span class="Keyword">proc</span> <a href="#waitEvents%2CAsyncEventQueue%5BT%5D%2CEventQueueKey%2Cint"><span class="Identifier">waitEvents</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <a href="asyncsync.html#EventQueueKey"><span class="Identifier">EventQueueKey</span></a><span class="Other">;</span> <span class="Identifier">eventsCount</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">,</span> <span class="Other">(</span><a href="asyncsync.html#AsyncEventQueueFullError"><span class="Identifier">AsyncEventQueueFullError</span></a><span class="Other">,</span> <a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a><span class="Other">)</span><span class="Other">]</span> {.<span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wait for events
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L578"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L578" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="items.i,AsyncQueue[T]">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CAsyncQueue%5BT%5D"><span class="Identifier">items</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Yield every element of <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L410"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L410" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="mitems.i,AsyncQueue[T]">
<dt><pre><span class="Keyword">iterator</span> <a href="#mitems.i%2CAsyncQueue%5BT%5D"><span class="Identifier">mitems</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Yield every element of <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L415"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L415" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="pairs.i,AsyncQueue[T]">
<dt><pre><span class="Keyword">iterator</span> <a href="#pairs.i%2CAsyncQueue%5BT%5D"><span class="Identifier">pairs</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">aq</span><span class="Other">:</span> <a href="asyncsync.html#AsyncQueue"><span class="Identifier">AsyncQueue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">,</span> <span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Yield every (position, value) of <tt class="docutils literal"><span class="pre">aq</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L420"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L420" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="readerOverflow.t,AsyncEventQueue,EventQueueReader">
<dt><pre><span class="Keyword">template</span> <a href="#readerOverflow.t%2CAsyncEventQueue%2CEventQueueReader"><span class="Identifier">readerOverflow</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="asyncsync.html#AsyncEventQueue"><span class="Identifier">AsyncEventQueue</span></a><span class="Other">;</span> <span class="Identifier">reader</span><span class="Other">:</span> <a href="asyncsync.html#EventQueueReader"><span class="Identifier">EventQueueReader</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/asyncsync.nim#L536"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/asyncsync.nim#L536" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="internal/asyncengine.html#setThreadDispatcher,PDispatcher"><span class="Identifier">setThreadDispatcher</span></a>, <a href="internal/asyncengine.html#closeSocket,AsyncFD,CallbackFunc"><span class="Identifier">closeSocket</span></a>, <a href="oserrno.html#ENOSR"><span class="Identifier">ENOSR</span></a>, <a href="oserrno.html#EHOSTUNREACH"><span class="Identifier">EHOSTUNREACH</span></a>, <a href="oserrno.html#EHOSTDOWN"><span class="Identifier">EHOSTDOWN</span></a>, <a href="oserrno.html#ECONNRESET"><span class="Identifier">ECONNRESET</span></a>, <a href="oserrno.html#EDQUOT"><span class="Identifier">EDQUOT</span></a>, <a href="internal/asyncfutures.html#fail.t,InternalRaisesFuture[T,E],ref.CatchableError,staticbool"><span class="Identifier">fail</span></a>, <a href="oserrno.html#ECANCELED"><span class="Identifier">ECANCELED</span></a>, <a href="oserrno.html#EMLINK"><span class="Identifier">EMLINK</span></a>, <a href="internal/asyncfutures.html#FuturePendingError"><span class="Identifier">FuturePendingError</span></a>, <a href="timer.html#milliseconds,SomeIntegerI64"><span class="Identifier">milliseconds</span></a>, <a href="timer.html#<=,Duration,Duration"><span class="Identifier">&lt;=</span></a>, <a href="timer.html#+=,Moment,Duration"><span class="Identifier">+=</span></a>, <a href="timer.html#$,Duration"><span class="Identifier">$</span></a>, <a href="timer.html#asyncTimer"><span class="Identifier">asyncTimer</span></a>, <a href="internal/asyncfutures.html#internalRaiseIfError.m,FutureBase,typed"><span class="Identifier">internalRaiseIfError</span></a>, <a href="srcloc.html#getSrcLocation.t,staticstring"><span class="Identifier">getSrcLocation</span></a>, <a href="futures.html#FutureError"><span class="Identifier">FutureError</span></a>, <a href="timer.html#fromNow,typedesc[Moment],Duration"><span class="Identifier">fromNow</span></a>, <a href="timer.html#weeks,Duration"><span class="Identifier">weeks</span></a>, <a href="oserrno.html#ESPIPE"><span class="Identifier">ESPIPE</span></a>, <a href="internal/asyncfutures.html#withTimeout,Future[T],Duration"><span class="Identifier">withTimeout</span></a>, <a href="futures.html#LocationKind"><span class="Identifier">LocationKind</span></a>, <a href="futures.html#id.t,FutureBase"><span class="Identifier">id</span></a>, <a href="timer.html#<=,Moment,Moment"><span class="Identifier">&lt;=</span></a>, <a href="internal/asyncfutures.html#FutureCompletedError"><span class="Identifier">FutureCompletedError</span></a>, <a href="oserrno.html#ENOEXEC"><span class="Identifier">ENOEXEC</span></a>, <a href="oserrno.html#ESHUTDOWN"><span class="Identifier">ESHUTDOWN</span></a>, <a href="internal/asyncfutures.html#fail.t,Future[T],ref.CatchableError,staticbool"><span class="Identifier">fail</span></a>, <a href="oserrno.html#EREMOTEIO"><span class="Identifier">EREMOTEIO</span></a>, <a href="timer.html#toString"><span class="Identifier">toString</span></a>, <a href="oserrno.html#EXFULL"><span class="Identifier">EXFULL</span></a>, <a href="internal/asyncfutures.html#waitFor,Future[void]"><span class="Identifier">waitFor</span></a>, <a href="internal/asyncfutures.html#complete.t,Future[T],T"><span class="Identifier">complete</span></a>, <a href="timer.html#==,Duration,Duration"><span class="Identifier">==</span></a>, <a href="internal/asyncfutures.html#oneValue,varargs[Future[T]]"><span class="Identifier">oneValue</span></a>, <a href="futures.html#internalInitFutureBase,FutureBase,ptr.SrcLoc,FutureState,FutureFlags"><span class="Identifier">internalInitFutureBase</span></a>, <a href="oserrno.html#EPROTONOSUPPORT"><span class="Identifier">EPROTONOSUPPORT</span></a>, <a href="timer.html#Nanosecond"><span class="Identifier">Nanosecond</span></a>, <a href="timer.html#epochNanoSeconds,Moment"><span class="Identifier">epochNanoSeconds</span></a>, <a href="internal/asyncfutures.html#cancelAndWait,FutureBase,ptr.SrcLoc"><span class="Identifier">cancelAndWait</span></a>, <a href="internal/asyncengine.html#addTimer,int64,CallbackFunc,pointer"><span class="Identifier">addTimer</span></a>, <
</dl></div>
</div>
</div>
<div class="row">
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2024-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>