Remove potentially blocking file I/O code (upgrade to eventcore 0.9.0).

- file and pipe closing are now asynchronous operations
- moveFile and removeFile are now executed in a worker thread
- requires eventcore ~>0.9.0
This commit is contained in:
Sönke Ludwig 2020-05-17 15:10:01 +02:00
parent d1340f9e10
commit a4e87237e4
4 changed files with 56 additions and 20 deletions

View file

@ -1,6 +1,7 @@
module vibe.core.internal.release;
import eventcore.core;
import std.stdint : intptr_t;
/// Release a handle in a thread-safe way
void releaseHandle(string subsys, H)(H handle, shared(NativeEventDriver) drv)
@ -19,8 +20,8 @@ void releaseHandle(string subsys, H)(H handle, shared(NativeEventDriver) drv)
// in case the destructor was called from a foreign thread,
// perform the release in the owner thread
drv.core.runInOwnerThread((h) {
__traits(getMember, eventDriver, subsys).releaseRef(cast(H)h);
}, cast(size_t)handle);
drv.core.runInOwnerThread((H handle) {
__traits(getMember, eventDriver, subsys).releaseRef(handle);
}, handle);
}
}