Commit graph

115 commits

Author SHA1 Message Date
Sönke Ludwig f9579a5dd2 Various task scheduling fixes.
- the initial task yield() now is done in an uninterruptible way
- switchToTask now handles switching to an already scheduled task gracefully
- TaskScheduler.hibernate() now properly blocks when called form outside of a task
- added yieldUninterruptible()
2016-06-16 10:58:12 +02:00
Sönke Ludwig ed36531bd2 Add runEventLoopOnce() and fix hibernate() to block outside of a task. 2016-06-16 10:44:55 +02:00
Sönke Ludwig e8ba981263 Draft proper shared semantics for ManualEvent. 2016-06-15 18:21:33 +02:00
Sönke Ludwig 8264070f19 Fix for latest eventcore changes. 2016-06-14 09:25:28 +02:00
Sönke Ludwig 3b0e4e0452 Big refactoring step.
- Moves a lot of stuff from vibe.core.core to vibe.core.task
- Introduces TaskScheduler to unify the scheduling process
- Refines how tasks are scheduled and processed (can push to the front of the task queue and uses a marker task to keep track of the spot up to which to process)
- Start to add proper support for task interrupts and timeouts by properly cancelling in-flight async operations
- Work on ManualEvent - still not functional for the shared case
- Implement proper IP address parsing in NetworkAddress
2016-06-14 08:01:03 +02:00
Sönke Ludwig c3857d1bc9 Fix compile errors. 2016-04-10 17:17:30 +02:00
Sönke Ludwig ba48a6f43a Use BatchBuffer instead of FixedRingBuffer for TCP read. 2016-04-10 17:17:15 +02:00
Sönke Ludwig 77dc93baa7 Add a function to disable vibe.d's default signal handlers. Fixes #1333.
(cherry picked from commit 29fab2e10bb864a8aee694d4a9de8f26fab2363e)
2016-04-10 14:40:40 +02:00
Sönke Ludwig 508669b781 Fix compile error when calling async() an unshared delegate.
(cherry picked from commit a8faddf64170e5d1347b67e1d48b7796bbe08fd9)
2016-04-10 14:40:40 +02:00
Sönke Ludwig 21619e8a30 Add allocation-less overloads of NetworkAddress.to(Address)String.
(cherry picked from commit 997d78ad36bfee853daefe663e3a54314a652b19)
2016-04-10 14:40:39 +02:00
Sönke Ludwig 76626f2fd4 Add support for FreeBSD and NetBSD
(cherry picked from commit 546fe60d327886265d3d14b447123010621013f6)
2016-04-10 14:40:39 +02:00
Sönke Ludwig 8f4222916f Weaken the task double-resumption assertion condition.
This assertion got triggered in a number of harmless situations and it's not always easy to avoid. Trying to avoid it, it has already caused a rather bad task starvation bug (#1441), so at this point it seems to be better to get rid of it.

See also #1407

(cherry picked from commit 621e34b388848c762a7525149ea449ad082996a1)
2016-04-10 14:40:39 +02:00
Sönke Ludwig 3a6583b375 Explictly avoid double-resumption of tasks during Libevent2TCPConnection.close().
The previous fix for #1376 resulted in a possible task starvation when the peer reset the connection before the outbound buffer was drained. The new approach now always resumes the waiting task exactly once, no matter how many events happen and no matter in which order.

(cherry picked from commit 350130a2b05cfbf12764ffaa6a86403eacf172d9)
2016-04-10 14:40:38 +02:00
Martin Nowak dc9002de0e make splitting of log lines configurable
- it might make sense to have newlines in a log message
  (e.g. when printing a backtrace) and they shouldn't
  be split into multiple log messages, e.g. when using syslog
- the splitting was fixed to work with more than one LF

(cherry picked from commit d14ce3dea1b98227dcd116acc6b175c56d9a1fb0)
2016-04-10 14:40:38 +02:00
Sönke Ludwig 7e2d1dd038 Initial commit.
The library is able to support simple TCP servers in the current state. The API is still mostly compatible with mainline vibe.d, but the driver systen has been replaced by the eventcore library and sockets/files/timers/... are now structs with automatic reference counting instead of GC collected classes. The stream interfaces have been removed for now.
2016-03-01 20:30:42 +01:00