9.0
top
← prev up next →

thread-utilsπŸ”— i

Roman Klochkov <kalimehtar@mail.ru>

This package provides some utilities to do common patterns of async programming.

procedure

( until-timeout func[timeouton-error])any/c

func:(->any/c)
timeout : (or/c#f(and/creal? (not/cnegative? ))(->any))
= 30
on-error:any/c=#f
Calls func and wait for answer not more then timeout. If func fails to complete until that moment and on-error is a procedure, then returns (on-error#f). If func raise an exception, applies on-error to the exception and returns it’s result. If on-error any other value, then it will be returned in case of error or timeout.

procedure

( thread-loop func[on-error])thread?

func:(->any/c)
on-error:any/c=#f
Returns thread, which runs func in infinite loop. When func raises an exception, applies on-error to the exception and run func again. If on-error is not a procedure, then errors are supressed.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /