- setTimer now starts a task to call the callback. This keeps the timer referenced and avoids issues if I/O functions are called from within the callback.
- SpinLock is now also initialized in "shared static this", so that applications using "shared static this" for initialization work properly.
- asyncAwaitAny now takes the callback type, so that parameter storage classes are handled correctly
- Implement TCPConnection.remoteAddress/localAddress
- Implement TCPConnection.tcpNoDelay, keepAlive and readTimeout
- Implement timeout handling for TCPConnection.waitForData
This simplifies the logic by separating thread local notifications from cross-thread notifications, as well as replacing lockless operations by a spin lock. The thread local variant of ManualEvent is now also separated into a LocalManualEvent type.
- Detection of the main thread contained a race condition
- The exit flag monitor task that is started for each event loop wasn't shut down, so that many could be running if runEventLoop was called multiple times.
Removes some invalid safety annotations and adds a workaround for a starvation issue in Task.join() across threads boundaries. This is still not thread-safe, but now has a safety-net and is documented, so that it doesn't get lost.
In situations where no events were involved in an multi-task scenario, the old behavior could lead to the process to starve or hang until an event arrived.
- 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()
- 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
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)
Commit 6be5471 switched FreeListRef to use FreeListObjectAlloc underneath, but didn't accound for the extra memory that is needed to store the reference count directly after the object payload. The possible implications of this are memory corruption and memory leaks, although with the predefined allocator setip, this will only happen to types with a POT size or slightly less.
This commit adds an "EXTRA" template type parameter to FreeListObjectAlloc that is used to determine the additional amount of allocated memory, which is set to "int" in the case of FreeListRef.
(cherry picked from commit d78a9ce89b845e4f89a84bd70bbd48c7595463d4)
(cherry picked from commit 613d15926e241c03e75bb2d237d39ba712613aeb)
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)
- 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)
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.