1. Implement all read() primitives using readLoop() like it was done in streams.
2. Fix readLine() bug.
3. Add readMessage() primitive.
4. Fixing exception hierarchy, handling code and simplification of (break/continue + exception).
5. Fix TLSStream closure procedure.
6. Add BoundedStream stream and tests.
7. Remove `result` usage from the code.
IPV6_MULTICAST_HOPS already declared in posix.nim while IP_MULTICAST_TTL
has a value that will stay constant on linux/x86_64 - better codegen and
nlvm compat like this.
* Add callIdle primitive.
* Make single idle callback to be processed by single poll() step.
Add idleAsync() primitive to allow wait for "idle" time.
Refactor some `result` usage.
it seems that due to a naming conflict from asyncdispatch, callSoon is
deduced to raise exceptions even if it doesn't in modules that import
both, even indirectly - this patch randomly works around the issue with
some more overloads
* Fix cancellation behavior.
Fix some compilation warnings.
* Fix cancelAndWait() and add proper documentation.
* Add completed(Future) and done(Future) calls to check if Future[T] completed without an error.
* Add stepsAsync() and tests.
* Fix comments.
* Fix new primitive comment, to avoid usage for task switches.
* release callback memory early
this fixes a memory leak where a deleted callback may keep references
alive until the future is finished.
In particular, when using helpers like `or` which try to remove
themselves from the callback list when a dependent future is completed,
create a reference chain between all futures in the expression - in the
pathological case where one of the futures is completes only rarely (for
example a timeout or a cancellation task), the buildup will be
significant.
* Removing unnecessary asserts, and place comments instead.
* Fix `locked` flag to be more consistent.
Refactor AsyncLock to not use `result`.
Add test for `locked` flag.
* Fixes.
* Fix imports.
* Fix multiple release() without scheduler.
Add more tests.
* Fix review comments.
* small fixes
* more efficient codegen for nil check (much less code)
* release futures earlier in AsyncEvent
* release finished future earlier in AsyncQueue
* avoid searches for futures (deque variant unused / broken)
* avoid catching defects
* Fix AsyncEvent test, because of optimization.
* delete fix
* avoid seq allocs
* Keep style consistent with other code.
Refactor AsyncEvent and AsyncQueue to not use `result` keyword.
Co-authored-by: cheatfate <eugene.kabanov@status.im>