vibe.d - asynchronously wait() for process to exit
cy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 18 00:48:23 PDT 2016
On Friday, 17 June 2016 at 13:53:15 UTC, Vladimir Panteleev wrote:
> Geod24 on IRC suggested signalfd + createFileDescriptorEvent. I
> think this would work, but isn't it possible to wrap the fd
> returned by signalfd into a Vibe.d stream and read it directly?
> I'm just not sure how.
Well, vibe.d streams are defined as interfaces, so you'd have to
import vibe.core.stream: InputStream, and create a SignalFdInput
class that implemented all the required methods. When it requires
you to "wait" for data available, you save
core.task.Task.getThis() somewhere, and... basically do what
you're doing with createFileDescriptorEvent, just resuming the
task instead of handling the event in a callback.
I should point out that createFileDescriptorEvent is an assert(0)
for libasync.
More information about the Digitalmars-d-learn
mailing list