@@ -90,7 +90,7 @@ <h1 class="title">src/sunk</h1>
90
90
91
91
</ ul >
92
92
< ul class ="simple nested-toc-section "> doOnce
93
- < li > < a class ="reference " href ="#doOnce%2Cproc%29%2Cbool " title ="doOnce(todo: proc (); cond: bool) "> doOnce(todo: proc (); cond: bool)</ a > </ li >
93
+ < li > < a class ="reference " href ="#doOnce%2Cproc%29%2Cbool%2Cint " title ="doOnce(todo: proc (); cond: var bool; ms: int or float = 5 ) "> doOnce(todo: proc (); cond: var bool; ms: int or float = 5 )</ a > </ li >
94
94
95
95
</ ul >
96
96
< ul class ="simple nested-toc-section "> every
@@ -102,7 +102,8 @@ <h1 class="title">src/sunk</h1>
102
102
103
103
</ ul >
104
104
< ul class ="simple nested-toc-section "> once
105
- < li > < a class ="reference " href ="#once%2Cbool%2Cproc%29 " title ="once(cond: bool; todo: proc ()) "> once(cond: bool; todo: proc ())</ a > </ li >
105
+ < li > < a class ="reference " href ="#once%2Cbool%2C%2Cproc%29 " title ="once(cond: var bool; ms: int or float; todo: proc ()) "> once(cond: var bool; ms: int or float; todo: proc ())</ a > </ li >
106
+ < li > < a class ="reference " href ="#once%2Cbool%2Cproc%29 " title ="once(cond: var bool; todo: proc ()) "> once(cond: var bool; todo: proc ())</ a > </ li >
106
107
107
108
</ ul >
108
109
< ul class ="simple nested-toc-section "> pause
@@ -281,12 +282,11 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
281
282
282
283
</ div >
283
284
< div id ="doOnce-procs-all ">
284
- < div id ="doOnce,proc),bool ">
285
- < dt > < pre > < span class ="Keyword "> proc</ span > < a href ="#doOnce%2Cproc%29%2Cbool "> < span class ="Identifier "> doOnce</ span > </ a > < span class ="Other "> (</ span > < span class ="Identifier "> todo</ span > < span class ="Other "> :</ span > < span class ="Keyword "> proc</ span > < span class ="Other "> (</ span > < span class ="Other "> )</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> cond</ span > < span class ="Other "> :</ span > < span class ="Identifier "> bool</ 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 ="Identifier "> Exception</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span >
286
- < span class ="Identifier "> tags</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Identifier "> TimeEffect</ span > < span class ="Other "> ,</ span > < span class ="Identifier "> RootEffect</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span > < span class ="Identifier "> forbids</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Other "> ]</ span > </ span > .}</ pre > </ dt >
285
+ < div id ="doOnce,proc),bool,int ">
286
+ < dt > < pre > < span class ="Keyword "> proc</ span > < a href ="#doOnce%2Cproc%29%2Cbool%2Cint "> < span class ="Identifier "> doOnce</ span > </ a > < span class ="Other "> (</ span > < span class ="Identifier "> todo</ span > < span class ="Other "> :</ span > < span class ="Keyword "> proc</ span > < span class ="Other "> (</ span > < span class ="Other "> )</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> cond</ span > < span class ="Other "> :</ span > < span class ="Keyword "> var</ span > < span class ="Identifier "> bool</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> ms</ span > < span class ="Other "> :</ span > < span class ="Identifier "> int</ span > < span class ="Keyword "> or</ span > < span class ="Identifier "> float</ span > < span class ="Other "> =</ span > < span class ="DecNumber "> 5</ span > < span class ="Other "> )</ span > </ pre > </ dt >
287
287
< dd >
288
288
289
- Checks < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> cond</ span > </ span > </ tt > in background every 5 milliseconds and executes actions passed as < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> todo</ span > </ span > </ tt > once it's true
289
+ Checks < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> cond</ span > </ span > </ tt > in background every < tt class =" docutils literal " > < span class =" pre " > < span class =" Identifier " > ms </ span > </ span > </ tt > milliseconds and executes actions passed as < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> todo</ span > </ span > </ tt > once it's true
290
290
< p > < strong class ="examples_text "> Example:</ strong > </ p >
291
291
< pre class ="listing "> < span class ="Keyword "> import</ span > < span class ="Identifier "> threadpool</ span > < span class ="Punctuation "> ,</ span > < span class ="Identifier "> os</ span >
292
292
@@ -341,10 +341,29 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
341
341
342
342
</ div >
343
343
< div id ="once-procs-all ">
344
- < div id ="once,bool,proc) ">
345
- < dt > < pre > < span class ="Keyword "> proc</ span > < a href ="#once%2Cbool%2Cproc%29 "> < span class ="Identifier "> once</ span > </ a > < span class ="Other "> (</ span > < span class ="Identifier "> cond</ span > < span class ="Other "> :</ span > < span class ="Identifier "> bool</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> todo</ span > < span class ="Other "> :</ span > < span class ="Keyword "> proc</ span > < span class ="Other "> (</ span > < span class ="Other "> )</ 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 ="Identifier "> Exception</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span >
346
- < span class ="Identifier "> tags</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Identifier "> TimeEffect</ span > < span class ="Other "> ,</ span > < span class ="Identifier "> RootEffect</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span >
347
- < span class ="Identifier "> forbids</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Other "> ]</ span > </ span > .}</ pre > </ dt >
344
+ < div id ="once,bool,,proc) ">
345
+ < dt > < pre > < span class ="Keyword "> proc</ span > < a href ="#once%2Cbool%2C%2Cproc%29 "> < span class ="Identifier "> once</ span > </ a > < span class ="Other "> (</ span > < span class ="Identifier "> cond</ span > < span class ="Other "> :</ span > < span class ="Keyword "> var</ span > < span class ="Identifier "> bool</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> ms</ span > < span class ="Other "> :</ span > < span class ="Identifier "> int</ span > < span class ="Keyword "> or</ span > < span class ="Identifier "> float</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> todo</ span > < span class ="Other "> :</ span > < span class ="Keyword "> proc</ span > < span class ="Other "> (</ span > < span class ="Other "> )</ span > < span class ="Other "> )</ span > </ pre > </ dt >
346
+ < dd >
347
+
348
+ Checks < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> cond</ span > </ span > </ tt > in background every < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> ms</ span > </ span > </ tt > milliseconds and executes actions passed as < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> todo</ span > </ span > </ tt > once it's true
349
+ < p > < strong class ="examples_text "> Example:</ strong > </ p >
350
+ < pre class ="listing "> < span class ="Keyword "> import</ span > < span class ="Identifier "> threadpool</ span > < span class ="Punctuation "> ,</ span > < span class ="Identifier "> os</ span >
351
+
352
+ < span class ="Keyword "> var</ span > < span class ="Identifier "> hasFinished</ span > < span class ="Operator "> =</ span > < span class ="Identifier "> false</ span >
353
+
354
+ < span class ="Keyword "> proc</ span > < span class ="Identifier "> longOps</ span > < span class ="Punctuation "> (</ span > < span class ="Punctuation "> )</ span > < span class ="Operator "> =</ span >
355
+ < span class ="Comment "> # let's fake long operations with sleep</ span >
356
+ < span class ="Identifier "> sleep</ span > < span class ="DecNumber "> 5_000</ span >
357
+ < span class ="Identifier "> hasFinished</ span > < span class ="Operator "> =</ span > < span class ="Identifier "> true</ span >
358
+
359
+ < span class ="Identifier "> spawn</ span > < span class ="Identifier "> longOps</ span > < span class ="Punctuation "> (</ span > < span class ="Punctuation "> )</ span >
360
+ < span class ="Identifier "> once</ span > < span class ="Punctuation "> (</ span > < span class ="Identifier "> hasFinished</ span > < span class ="Punctuation "> ,</ span > < span class ="DecNumber "> 10</ span > < span class ="Punctuation "> )</ span > < span class ="Keyword "> do</ span > < span class ="Punctuation "> (</ span > < span class ="Punctuation "> )</ span > < span class ="Punctuation "> :</ span > < span class ="Identifier "> echo</ span > < span class ="StringLit "> "Finished !"</ span > </ pre >
361
+
362
+ </ dd >
363
+ </ div >
364
+ < div id ="once,bool,proc) ">
365
+ < dt > < pre > < span class ="Keyword "> proc</ span > < a href ="#once%2Cbool%2Cproc%29 "> < span class ="Identifier "> once</ span > </ a > < span class ="Other "> (</ span > < span class ="Identifier "> cond</ span > < span class ="Other "> :</ span > < span class ="Keyword "> var</ span > < span class ="Identifier "> bool</ span > < span class ="Other "> ;</ span > < span class ="Identifier "> todo</ span > < span class ="Other "> :</ span > < span class ="Keyword "> proc</ span > < span class ="Other "> (</ span > < span class ="Other "> )</ 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 ="Identifier "> Exception</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span >
366
+ < span class ="Identifier "> tags</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Identifier "> TimeEffect</ span > < span class ="Other "> ,</ span > < span class ="Identifier "> RootEffect</ span > < span class ="Other "> ]</ span > < span class ="Other "> ,</ span > < span class ="Identifier "> forbids</ span > < span class ="Other "> :</ span > < span class ="Other "> [</ span > < span class ="Other "> ]</ span > </ span > .}</ pre > </ dt >
348
367
< dd >
349
368
350
369
Checks < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> cond</ span > </ span > </ tt > in background every 5 milliseconds and executes actions passed as < tt class ="docutils literal "> < span class ="pre "> < span class ="Identifier "> todo</ span > </ span > </ tt > once it's true
@@ -439,7 +458,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
439
458
< div class ="twelve-columns footer ">
440
459
< span class ="nim-sprite "> </ span >
441
460
< br >
442
- < small style ="color: var(--hint); "> Made with Nim. Generated: 2023-05-06 18:16:39 UTC</ small >
461
+ < small style ="color: var(--hint); "> Made with Nim. Generated: 2023-05-07 00:39:45 UTC</ small >
443
462
</ div >
444
463
</ div >
445
464
</ div >
0 commit comments