Commit graph

191 commits

Author SHA1 Message Date
Sönke Ludwig 4f69b1eaf3 Add setTaskCreationCallback() for better remote debugger integration. 2017-07-16 22:07:59 +02:00
Sönke Ludwig 719c62d6c9
Fix TLS initialization condition. 2017-07-16 00:08:07 +02:00
Sönke Ludwig 7efb496208
Fix double-free of ThreadLocalWaiter in ManualEvent.
Also adds assertions and a randomized multi-thread test to rule out similar issues with a higher confidence.
2017-07-15 18:16:13 +02:00
Sönke Ludwig 254d91dcdf
Improve error message. 2017-07-15 10:12:52 +02:00
Sönke Ludwig 87296bb1e4 Fix compilation error for VibeIdleCollect. 2017-07-10 19:46:16 +02:00
Sönke Ludwig ca2f9dbe91 Add UDP multicast declarations matching rejectedsoftware/vibe.d#1806.
The actual functionality still needs to be implemented in eventcore.
2017-07-08 10:44:42 +02:00
Sönke Ludwig 429d5dcb77 Fix GenericPath.parentPath. 2017-07-07 22:29:12 +02:00
Sebastian Wilzbach 8f89733a86 Remove all trailing whitespace
sed 's/[ \t]*$//' -i **/*.d
2017-07-03 12:19:27 +02:00
Sebastian Wilzbach 04b3575c14 Remove deprecated stdc import 2017-07-03 00:39:41 +02:00
Sönke Ludwig 01ed0a43de Adjust for eventcore 0.8.12. 2017-06-27 01:11:50 +02:00
Sönke Ludwig f123e55fa9 Fix assertion condition. 2017-06-22 16:22:11 +02:00
Sönke Ludwig ed9efd9f44 Merge pull request #10 from wilzbach/allow-removal-of-the-default-logger
Allow removal of the default logger
2017-06-22 10:25:20 +02:00
Sönke Ludwig fd93ab82f5
Remove deprecation attribute for the system overload of setTimer.
The approach for now is to keep overloads that receive system delegates and are also marked system in turn. This breaks safety promises in some places within the library, but is an acceptable first step that keeps other possible directions open.
2017-06-22 09:38:56 +02:00
Sönke Ludwig f40da06385
Update version number. 2017-06-22 09:36:49 +02:00
Sönke Ludwig 07e077a009
Redesign the Path type to statically encode the path format.
The previous design, while intended as an improvement over the one-size-fits all Path struct of vibe-d:core, turned out to produce lots of bugs during the transition, because of missing Path.type checks.

The new design uses a cleaner approach, where the static type of a path value encodes the path format. An explicit cast is necessary to convert between different path types. The internet path type also performs proper validation and percent encoding, so that InetPath.toString() always produces a valid URI path.
2017-06-21 14:04:24 +02:00
Sönke Ludwig 7d7e4709c1
Fix nothrow overloads of lock(). 2017-06-15 13:45:14 +02:00
Sönke Ludwig 0d164708ec Fix Windows->inet/Posix path conversion issue. 2017-06-15 10:04:55 +02:00
Sönke Ludwig 5c156d1e90 Clarify async() semantics. 2017-06-12 17:34:09 +02:00
Sönke Ludwig 62e3add3ab Fix a number of issues related to mixing different path types. 2017-06-12 17:33:25 +02:00
Sönke Ludwig 6f7c897f91 Fix getFileInfo name return value for paths that end with a slash. 2017-06-12 17:31:52 +02:00
Sönke Ludwig bc689489a8
Add yieldLock(), which enables enforcing no task switches within a scope.
runTask() was altered to delay the task switch in case it gets called within an active yieldLock(), so that running tasks is still possible.
2017-06-11 11:40:25 +02:00
Sönke Ludwig 698824e811
Partially implement FileDescriptorStream.
Currently only works for waiting on read-readiness (eventcore is not exposing an analog function for write-readiness).
2017-05-30 11:02:22 +02:00
Sönke Ludwig 99a5b882d8
Limit the number of recycled fibers.
This allows the process to free up memory after heavy load spikes, while not impacting performance negatively.
2017-05-30 11:00:37 +02:00
Sönke Ludwig 0aed5664ef
Let openFile throw on failure instead of returning an invalid stream. 2017-05-30 10:57:31 +02:00
Dentcho Bankov aef2936abd Fix for #11. Cross port of fix for #1742 from vibe.d 2017-04-15 00:04:08 +03:00
Sönke Ludwig e3c680b0ce
Add assertion to ManualEvent to check for failure of creating event handles. 2017-03-27 16:32:24 +02:00
Sönke Ludwig 0895cd1960
Avoid bogus assertion failure.
Since the task queue entries never got cleaned up, the assertion got triggered once already used queue slots were starting to get reused.
2017-03-27 16:31:52 +02:00
Sönke Ludwig e81589fa3e
(Re)implement JSON configuration support for readOption.
Since the core->data dependency was removed, this had to be commented out. It is now implemented in terms of std.json.
2017-03-25 14:16:22 +01:00
Sönke Ludwig e769a9b1ca Avoid lazy evaluation of log arguments while the loggers are locked. Fixes rejectedsoftware/vibe.d#1717.
The deadlock happened because a function that waits for a worker task to finish was passed to the log functions. Evaluated lazily, it got called while the logger's mutex was locked, meaning that any log call from within that thread would cause a deadlock.

This change also has another, possibly important, implication - arguments are evaluated only once instead of possibly multiple times if multiple loggers are registered. This could very well make a lot of existing (wrong) code more robust (e.g. logInfo("%s", i++)).
2017-03-23 17:55:51 +01:00
Sebastian Wilzbach c80a15321e Allow removal of the default logger 2017-03-22 13:45:32 +01:00
Sönke Ludwig e3f9d07e58
Don't store local/remote address for UDP connections.
Errored out due to the space requirements of UNIX addresses.
2017-03-10 23:00:43 +01:00
Sönke Ludwig 5fd9fc4007
Always compute TCPConnection.xxxAddress on demand.
Storing the network addresses becomes too expensive with UNIX socket support.
2017-03-10 21:06:18 +01:00
Sönke Ludwig ed8b33786b
Compile fixes. 2017-03-10 20:07:04 +01:00
Sönke Ludwig 1edfc88e63 Add UNIX address type support to NetworkAddress. 2017-03-10 19:53:40 +01:00
Sönke Ludwig 77eddebe45 Improve Path compatibility with the original implementation. 2017-03-10 19:53:07 +01:00
Sönke Ludwig 1d9e88f27a Fix createTempFile on Windows. 2017-03-09 16:09:46 +01:00
Sönke Ludwig de718c4b1c
Add runTask overloads to make lambda argument inference work. 2017-02-23 16:39:42 +01:00
Sönke Ludwig 897c43051f
Fix nothrow inference for runTask. 2017-02-23 15:49:59 +01:00
Sönke Ludwig b995bdaa72
Use thread wait primitives for worker thread shutdown.
Avoids possible issues due to tasks interleaving the shutdown on the same thread.
2017-02-23 14:43:22 +01:00
Sönke Ludwig 3dbdc90927
Fix shutdown when no worker tasks have been used. 2017-02-22 23:26:16 +01:00
Sönke Ludwig 76882b3bd7 Remove temporary debug log messages. 2017-02-22 19:58:11 +01:00
Sönke Ludwig 9ac908c599 Use a ring buffer for worker tasks and make TaskFuncInfo creation slightly more efficient. 2017-02-22 19:52:22 +01:00
Sönke Ludwig 40713db075 Move worker task logic into a new TaskPool class. 2017-02-22 18:35:51 +01:00
Sönke Ludwig f9372446b1 Improve the sync module.
- Change the API of Monitor to work without a callback
- Add ManualEvent.emitSingle
2017-02-22 17:42:20 +01:00
Sönke Ludwig 6f26766c70 Fix the "threadTime" log format to be consistent with "thread". 2017-02-22 17:36:43 +01:00
Sönke Ludwig 531398e28d Merge branch 'master' of github.com:vibe-d/vibe-core 2017-02-19 13:52:54 +01:00
Sönke Ludwig 3f83bef219 Fix Path.parentPath and Path.toString for PathType.windows. 2017-02-18 16:00:27 +01:00
Sönke Ludwig 68430a1ea4
Fix file pointer management in FileStream. Fixes rejectedsoftware/vibe.d#1684. 2017-02-16 23:37:41 +01:00
Sönke Ludwig db29e4730f Let uncaught errors in fibers terminate the process. 2017-02-16 11:56:04 +01:00
Sönke Ludwig 93b342bf77 Fix compilation error on Windows. 2017-02-16 10:20:21 +01:00
Sönke Ludwig b8663f9fbc
Conditionally compile TaskFiber.state.
See https://issues.dlang.org/show_bug.cgi?id=17131
2017-02-01 11:05:53 +01:00
Sönke Ludwig 2ed82ca975
Add compatibility overload for ConnectionPool.this.
See rejectedsoftware/vibe.d#1664.
2017-02-01 10:27:08 +01:00
Sönke Ludwig df4022d83e
Add stream proxy types to allow user code to store generic streams. 2017-01-31 16:48:04 +01:00
Sönke Ludwig 72913575f4
Fix error message. 2017-01-30 22:52:36 +01:00
Sönke Ludwig d9c373419a
Fixup for the previous timer fix. 2017-01-30 20:12:37 +01:00
Sönke Ludwig f5c2177c5d
Fix createTimer() when called with a callback. 2017-01-30 19:55:34 +01:00
Sönke Ludwig c490a354b7
Handle Timer.stop() gracefully for null timers. 2017-01-30 17:34:25 +01:00
Sönke Ludwig b7e996cd8c
Let TCPConnection.peek() handle closed connections gracefully. 2017-01-30 17:27:43 +01:00
Sönke Ludwig 2dccd43277
Let TCPConnection.waitForData amd leastSize act gracefully on closed connections. 2017-01-30 12:04:21 +01:00
Sönke Ludwig ac811ba501
Remove buggy NetworkAddress.toUnknownAddress.
UnknownAddress is not large enough to hold either IPv6 or UDS addresses.
2017-01-30 11:40:11 +01:00
Sönke Ludwig d2629ef053
Don't throw on read error in TCPConnection.waitForData. 2017-01-30 11:29:01 +01:00
Sönke Ludwig 4c9b6c0fb8
Properly check return value of createDatagramSocket. 2017-01-30 11:19:51 +01:00
Sönke Ludwig 8f6c4dd536
Fix LocalTaskSemaphore.
Fixes a potential hang, potential over-use of lock slots and only needs a single LocalManualEvent now instead of one created for each wait.
2017-01-30 10:07:06 +01:00
Sönke Ludwig 76df9212ef
Fix accessibility issue for std.concurrency.send. 2017-01-30 09:43:43 +01:00
Sönke Ludwig 84a21f7e9d
Add compatibility overloads for listenTCP. 2017-01-30 09:19:08 +01:00
Sönke Ludwig e88d2d1b4b
Fix segfault in DirectoryWatcher. 2017-01-29 22:11:17 +01:00
Sönke Ludwig d0a55ef374
Add an uninterruptible variant of Task.join. 2017-01-29 20:20:08 +01:00
Sönke Ludwig 96b798200c
Make more network methods nothrow.
TCPConection properties and NetworkAddress.to(Address)String have been marked nothrow.
2017-01-29 20:19:38 +01:00
Sönke Ludwig 2ff37202c0
Add compatibility overload for setTimer(). 2017-01-29 16:46:21 +01:00
Sönke Ludwig 798f0ef446
Implement support for TCPListenOptions.reusePort. 2017-01-27 22:51:17 +01:00
Sönke Ludwig b391ebabbe
Add more specific assertion for SpinLock initialization. 2017-01-27 22:50:57 +01:00
Sönke Ludwig fc96ee9050
Fixes for setTimer and SpinLock.
- 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.
2017-01-27 22:50:29 +01:00
Sönke Ludwig 71c83440d3
Remove the deprecated OutputStream.write methods.
They will stay deprecated in vibe-d 0.8.0, but vibe-core will be released without them.
2017-01-27 00:10:09 +01:00
Sönke Ludwig 5249c1c4c6
Fix infinite recursion in TCPConnection.(local/remote)Address properties. 2017-01-26 13:58:14 +01:00
Sönke Ludwig 373f82c16b
Deprecate stream based OutputStream.write overloads.
Replaced by a global pipe() function that supports non-class streams, too.
2017-01-25 22:42:35 +01:00
Sönke Ludwig 5f980acefd
Upgrade to latest eventcore. 2017-01-25 21:04:13 +01:00
Sönke Ludwig 2acc60934f
Add IOMode parameters to stream read/write methods. 2017-01-19 00:36:32 +01:00
Sönke Ludwig e80d7244bc
Add PathEntry.validateFilename. 2017-01-19 00:33:52 +01:00
Sönke Ludwig fb706ea0b6
Properly implement struct Path.
The new implementation is @nogc where possible.
2017-01-17 23:50:33 +01:00
Sönke Ludwig 9d4e8086ff Make the callback type the first argument to Waitable!(). 2017-01-16 00:23:37 +01:00
Sönke Ludwig 964d72f3b5 Fix handling of scoped callback parameters in eventcore callbacks. 2017-01-16 00:20:35 +01:00
Sönke Ludwig f3c84d497e Fix bind address handling for connectTCP. 2017-01-15 23:17:14 +01:00
Sönke Ludwig 24b940039d Implement UDPConnection.canBroadcast/localAddress. 2017-01-15 22:19:41 +01:00
Sönke Ludwig f015662a94 TCPConnection and async improvements.
- 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
2017-01-15 20:59:36 +01:00
Sönke Ludwig fdfbb55aa8 Re-implement ManualEvent.
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.
2017-01-13 22:24:18 +01:00
Sönke Ludwig e28c6950d7 Fix shutdown behavior.
- 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.
2017-01-13 22:11:59 +01:00
Sönke Ludwig 7803fdaa81 Make Task.interrupt nothrow + add diagnostic assertion. 2017-01-13 22:08:12 +01:00
Sönke Ludwig ece639ee01 Improve assertion/test coverage of ManualEvent. 2017-01-11 17:46:36 +01:00
Sönke Ludwig 35a94412d0 Make FileStream small enough to fit into an InterfaceProxy. 2016-12-26 21:28:36 +01:00
Sönke Ludwig da2dfa23df Only emit color escape sequences on a Posix terminal. 2016-12-19 21:22:22 +01:00
Sönke Ludwig 8c0660781d Thread safety improvements in the task system.
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.
2016-12-19 20:24:08 +01:00
Sönke Ludwig 1b2c0f33d1 Fix timeout handling in ManualEvent.
The timeout could was re-applied in every loop iteration of the wait routine, possibly causing an infinite loop.
2016-12-19 20:19:58 +01:00
Sönke Ludwig 79656a80df Fix safety error on Windows. 2016-12-19 16:16:50 +01:00
Sönke Ludwig a7bfbc1c45 Implement createTempFile on Posix. 2016-12-10 16:01:40 +01:00
Sönke Ludwig bf2edc7fb2 Fix TaskScheduler.waitAndProcess to not block if any tasks were resumed.
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.
2016-12-10 14:13:44 +01:00
Sönke Ludwig 942089a91c Add unit tests for joinding tasks from outside of another task. 2016-11-29 19:17:14 +01:00
Sönke Ludwig ccbd6a063f Fix FreeListRef related issues. 2016-11-10 12:01:35 +01:00
Sönke Ludwig f74c30a9f3 Use std.experimental.allocator and remove the custom allocator module. 2016-11-08 15:32:25 +01:00
Sönke Ludwig 4b4e1575dc Extend the Path interface somewhat. 2016-11-08 14:48:18 +01:00
Sönke Ludwig 0c3c31b969 Annotate more of Task/TaskLocal as safe. 2016-11-04 21:33:01 +01:00