Announcing libasync, a cross-platform D event loop

Adam Wilson via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 26 21:25:23 PDT 2014


On Wed, 24 Sep 2014 06:13:31 -0700, Etienne <etcimon at gmail.com> wrote:

> It's finally here: https://github.com/etcimon/libasync
>
> We all know how event loops are the foundation of more popular libraries  
> Qt and Nodejs.. we now have a natively compiling async library entirely  
> written in D.
>
> This event library was tested on Win32, Linux x64, Mac OS x64, with DMD  
> 2.066, offers the more low-level async objects: timers, file i/o, dns  
> resolver, tcp, udp, listeners, signals (cross-thread), notifications  
> (same thread), and more recently (and with great efforts for  
> implementing with OS X / BSD) a directory watcher.
>
> e.g. You can run a timer with:
>
> 	import std.datetime; import std.stdio; import libasync.all;
> 	EventLoop evl = new EventLoop;
> 	auto timer = new AsyncTimer(evl);
> 	timer.duration(2.seconds).periodic().run({ writeln("Another 2 seconds  
> have passed"); });
> 	while(evl.loop()) continue;
>
> The tests may be most revealing:  
> https://github.com/etcimon/libasync/blob/master/source/libasync/test.d
>
> A (lightly tested) vibe.d driver using all those async objects is also  
> available and currently ongoing a pull request:
>
> https://github.com/etcimon/vibe.d/tree/native-events
>
> The incentive was to make vibe.d compile in completely native D, I'm now  
> moving onto a botan C++ => D wrapper for it, I plan on moving objects to  
> D over the years until the TLS library can be completely native. I thank  
> Walter for the efforts on extern(C++)
>
> Finally, I release this on the basis of an MIT license, looking forward  
> to seeing our community flourishing with yet more native libraries. Code  
> on

You mentioned Botan. I already have a C++ => D Wrapper project going over  
here: https://github.com/ellipticbit/titanium

I am working out a bug where the memory corrupts itself when passing data  
back to D but it works and most of the leg-work is done. And I am  
definitely open to pull-requests.

-- 
Adam Wilson
GitHub/IRC: LightBender
Aurora Project Coordinator


More information about the Digitalmars-d mailing list