Announcing libasync, a cross-platform D event loop
Etienne Cimon via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 28 14:29:15 PDT 2015
On Sunday, 28 June 2015 at 19:34:46 UTC, Suliman wrote:
> void main()
> {
>
> void dirWatcher()
> {
> auto g_watcher = new
> AsyncDirectoryWatcher(getThreadEventLoop());
> g_watcher.run({
> DWChangeInfo[1] change;
> DWChangeInfo[] changeRef = change.ptr[0..1];
> while(g_watcher.readChanges(changeRef)){
> writeln(change);
> }
> });
> g_watcher.watchDir(".");
> getThreadEventLoop();
>
> }
>
> dirWatcher();
>
> //destroyAsyncThreads();
>
> }
> Is this code enough to monitoring folder?
>
> If I run it it's terminating, it's seems that eventloop not
> starting or I placed it in wrong place?
You should do getThreadEventLoop().loop(); and it will monitor
the changes forever. Try making changes in the filesystem
manually :)
More information about the Digitalmars-d
mailing list