d9555bea1b
While it does make sense to make readers unblock by setting the read event on teardown, this is something that consumers of the library should do _before_ calling EndSession, not something that makes sense for the library to do itself. The reason is that, in the hypothetical case in which this makes sense, immediately after unblocking the reader via SetEvent, the function goes on to free all of the memory that that reader might want to use. So, rather, the proper shutdown flow is from the application side, and looks like: Closing = true; SetEvent(WintunGetReadWaitEvent()); WaitForReadersToReturn(); WintunEndSession(); Alternatively, rather than using WaitForSingleObject on the read event, consumers can WaitForMultipleObjects and include a shutdown event, which is what the example code does. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> |
||
---|---|---|
.. | ||
adapter.c | ||
adapter.h | ||
api.vcxproj | ||
api.vcxproj.filters | ||
elevate.c | ||
elevate.h | ||
entry.c | ||
entry.h | ||
exports.def | ||
extract-driverver.js | ||
logger.c | ||
logger.h | ||
namespace.c | ||
namespace.h | ||
nci.def | ||
nci.h | ||
ntdll.h | ||
pch.c | ||
registry.c | ||
registry.h | ||
resource.c | ||
resource.h | ||
resources.rc | ||
rundll32_i.c | ||
rundll32.c | ||
session.c | ||
wintun.h |