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:
parent
768c6cf4c8
commit
496e99c3b4
24 changed files with 1243 additions and 586 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue