Make the API robust against using invalid handles. Fixes #105.

Introduces a "validationCounter" field for all handle types that gets incremented (at least) whenever an OS file descriptor/handle gets invalidated or re-allocated. This way, an old eventcore handle to a reused OS handle can always be distinguished from the current one to avoid interference.
This commit is contained in:
Sönke Ludwig 2020-05-09 14:41:18 +02:00
parent 768c6cf4c8
commit 496e99c3b4
24 changed files with 1243 additions and 586 deletions

View file

@ -24,7 +24,7 @@ import eventcore.internal.utils : mallocT, freeT;
import core.sys.windows.windows;
static assert(HANDLE.sizeof <= FD.BaseType.sizeof);
static assert(FD(cast(size_t)INVALID_HANDLE_VALUE) == FD.init);
static assert(FD(cast(size_t)INVALID_HANDLE_VALUE, 0) == FD.init);
final class WinAPIEventDriver : EventDriver {