From eb3620056f3a99cf9d66bb937bb834ed46060bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 8 Mar 2018 14:24:22 +0100 Subject: [PATCH 1/2] Ensure async lambdas are templates to fix LDC linker errors. Fixes #65. If the lambda is a concrete function, two different versions will end up for it in the final binary on macOS when compiled with LDC. Using argument inference works around that issue. --- source/vibe/core/core.d | 2 +- source/vibe/core/net.d | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index b34b876..419dd0e 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -991,7 +991,7 @@ struct FileDescriptorEvent { alias readwaiter = Waitable!(IOCallback, cb => eventDriver.sockets.waitForData(m_socket, cb), cb => eventDriver.sockets.cancelRead(m_socket), - (StreamSocketFD fd, IOStatus st, size_t nb) { got_data = st == IOStatus.ok; } + (fd, st, nb) { got_data = st == IOStatus.ok; } ); asyncAwaitAny!(true, readwaiter)(timeout); diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index cc842ad..e1aeabe 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -201,7 +201,7 @@ TCPConnection connectTCP(NetworkAddress addr, NetworkAddress bind_address = anyA alias waiter = Waitable!(ConnectCallback, cb => eventDriver.sockets.connectStream(uaddr, baddr, cb), - (ConnectCallback cb, StreamSocketFD sock_fd) { + (cb, sock_fd) { cancelled = true; eventDriver.sockets.cancelConnectStream(sock_fd); }, @@ -610,7 +610,7 @@ mixin(tracer); determined or the specified timeout is reached. */ WaitForDataAsyncStatus waitForDataAsync(CALLABLE)(CALLABLE read_ready_callback, Duration timeout = Duration.max) - if (is(typeof(read_ready_callback(true)))) + if (is(typeof(() @safe { read_ready_callback(true); } ()))) { mixin(tracer); import vibe.core.core : setTimer; From 84cf2fd519dd23c1c04b7a6ceeb29e163f46cc57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 8 Mar 2018 15:39:39 +0100 Subject: [PATCH 2/2] Update change log. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f19f6f2..16e8b0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,16 @@ - Fixed a task scheduling assertion happening when worker tasks and timers were involved - [issue #58][issue58], [pull #60][issue60] - Fixed a race condition in `TaskPool` leading to random assertion failures - [7703cc6][commit7703cc6] - Fixed an issue where the event loop would exit prematurely when calling `yield` - [issue #66][issue66], [pull #67][issue67] +- Fixed/worked around a linker error on LDC/macOS - [issue #65][issue65], [pull #68][issue68] [issue52]: https://github.com/vibe-d/vibe-core/issues/52 [issue58]: https://github.com/vibe-d/vibe-core/issues/58 [issue60]: https://github.com/vibe-d/vibe-core/issues/60 [issue62]: https://github.com/vibe-d/vibe-core/issues/62 +[issue65]: https://github.com/vibe-d/vibe-core/issues/65 [issue66]: https://github.com/vibe-d/vibe-core/issues/66 [issue67]: https://github.com/vibe-d/vibe-core/issues/67 +[issue68]: https://github.com/vibe-d/vibe-core/issues/68 [commit7703cc6]: https://github.com/vibe-d/vibe-core/commit/7703cc675f5ce56c1c8b4948e3f040453fd09791