Make file and pipe closing asynchronous.
CloseHandle can block for extended periods of time in certain cases, causing the whole thread to be blocked otherwise.
This commit is contained in:
parent
86ee5c9477
commit
85dc8d54e6
11 changed files with 165 additions and 94 deletions
|
@ -36,13 +36,15 @@ void main()
|
|||
assert(status == IOStatus.ok);
|
||||
assert(nbytes == data.length - 5);
|
||||
assert(dst == data);
|
||||
eventDriver.files.close(f);
|
||||
() @trusted {
|
||||
scope (failure) assert(false);
|
||||
remove("test.txt");
|
||||
} ();
|
||||
eventDriver.files.releaseRef(f);
|
||||
s_done = true;
|
||||
eventDriver.files.close(f, (f, s) {
|
||||
assert(s == CloseStatus.ok);
|
||||
() @trusted {
|
||||
scope (failure) assert(false);
|
||||
remove("test.txt");
|
||||
} ();
|
||||
eventDriver.files.releaseRef(f);
|
||||
s_done = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ void main()
|
|||
|
||||
void threadFunc(shared(NativeEventDriver) drv)
|
||||
{
|
||||
drv.core.runInOwnerThread((id) {
|
||||
drv.core.runInOwnerThread((int id) {
|
||||
s_id = id;
|
||||
}, 42);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue