Commit Graph

8 Commits

Author SHA1 Message Date
Jacek Sieka 4abd7a5645
exception tracking (#166)
* exception tracking

This PR adds minimal exception tracking to chronos, moving the goalpost
one step further.

In particular, it becomes invalid to raise exceptions from `callSoon`
callbacks: this is critical for writing correct error handling because
there's no reasonable way that a user of chronos can possibly _reason_
about exceptions coming out of there: the event loop will be in an
indeterminite state when the loop is executing an _random_ callback.

As expected, there are several issues in the error handling of chronos:
in particular, it will end up in an inconsistent internal state whenever
the selector loop operations fail, because the internal state update
functions are not written in an exception-safe way. This PR turns this
into a Defect, which probably is not the optimal way of handling things
- expect more work to be done here.

Some API have no way of reporting back errors to callers - for example,
when something fails in the accept loop, there's not much it can do, and
no way to report it back to the user of the API - this has been fixed
with the new accept flow - the old one should be deprecated.

Finally, there is information loss in the API: in composite operations
like `poll` and `waitFor` there's no way to differentiate internal
errors from user-level errors originating from callbacks.

* store `CatchableError` in future
* annotate proc's with correct raises information
* `selectors2` to avoid non-CatchableError IOSelectorsException
* `$` should never raise
* remove unnecessary gcsafe annotations
* fix exceptions leaking out of timer waits
* fix some imports
* functions must signal raising the union of all exceptions across all
platforms to enable cross-platform code
* switch to unittest2
* add `selectors2` which supercedes the std library version and fixes
several exception handling issues in there

* fixes

* docs, platform-independent eh specifiers for some functions

* add feature flag for strict exception mode

also bump version to 3.0.0 - _most_ existing code should be compatible
with this version of exception handling but some things might need
fixing - callbacks, existing raises specifications etc.

* fix AsyncCheck for non-void T
2021-03-24 10:08:33 +01:00
cheatfate fb00b20cfa
Fix all compilation warnings for 1.0.2.
Fix all related problems.
2019-10-29 23:19:41 +02:00
cheatfate a039011f5b
Fix clock_gettime() is not available on old MacOS. 2019-09-03 17:30:28 +03:00
cheatfate 03eb8a0157
Add pipe support for StreamTransport.
Bump version to 2.2.8.
2019-07-15 12:59:42 +03:00
cheatfate a2b85a8126
Fix for `$`(0). 2019-03-27 07:54:41 +02:00
cheatfate da4709d735
Convert cast[int64] to int64, to allow usage at compile time.
Fix 32bit compilation issue.
2019-03-25 23:24:32 +02:00
Eugene Kabanov 67e214c5df Introduce monotonic timer functions. (#24)
* Introduce monotonic timer functions.
Old fast timers are available through compiler switch.
Add tests for both timers.
* Bump version to 2.2.2.
2019-03-24 10:57:36 -06:00
Mamy Ratsimbazafy 9f15c6b752
Rebrand Asyncdispatch2 to Chronos [WIP] (#20)
* Update file headers, copyright date

* Rename files and hopefully fix nimble

* Forgot to change path in tests

* Update readme
2019-02-06 15:49:11 +01:00