libasync
libasync copied to clipboard
segfault starting AsyncDirectoryWatcher on MacOS X
* thread #2: tid = 0xacca0, 0x00000001000b4b81 dude`D8libasync5posix13EventLoopImpl4loopMFNbS4core4time8DurationZb + 1041, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x00000001000b4b81 dude`D8libasync5posix13EventLoopImpl4loopMFNbS4core4time8DurationZb + 1041
frame #1: 0x0000000100099bb4 dude`D8libasync6events9EventLoop4loopMFNbS4core4time8DurationZb + 68
frame #2: 0x000000010003461a dude`D7watcher5startFZ9__lambda1MFZv + 230
frame #3: 0x00000001000d4174 dude`D4core6thread6Thread3runMFZv + 44
frame #4: 0x00000001000d35eb dude`thread_entryPoint + 203
frame #5: 0x00007fff89409c13 libsystem_pthread.dylib`_pthread_body + 131
frame #6: 0x00007fff89409b90 libsystem_pthread.dylib`_pthread_start + 168
frame #7: 0x00007fff89407375 libsystem_pthread.dylib`thread_start + 13
This is the bit of code that instantiates it - the exact same code works fine on both Windows and Linux:
thread_ = new Thread({
auto eventLoop = getThreadEventLoop();
auto changes = uninitializedArray!(DWChangeInfo[])(32);
foreach (ref cdef; defs_) (){
auto def = cdef;
auto watcher = new AsyncDirectoryWatcher(eventLoop);
watcher.run({
while (true) {
if (auto count = watcher.readChanges(changes))
continue;
break;
}
def.callable();
});
auto path = buildNormalizedPath(cwd, def.path);
if (!watcher.watchDir(path, DWFileEvent.ALL, def.recursive))
throw new Exception(format("[$system] failed to watch directory '%s' for changes", path));
}();
while (running_ && eventLoop.loop)
continue;
});
Unfortunately, I don't have access to a Mac at the moment so can't be of much help...