async-std in Windows cdylib dlls (LoadLibrary/FreeLibrary startup/cleanup)
- Dominant language
- Rust
- Stars
- 4.1k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to use async-std in Windows cdylibs that are being loaded/unloaded with `LoadLibrary`/`FreeLibrary`?
For this we'd have to ensure that before `DllMain` with `PROCESS_DETACH` returns, ***all*** threads that were spawned by async-std are no longer running. Unfortunately I do not have a clear overview over the intrinsic behaviour of async-std's thread pools, reactors (are they still a thing?) and whatnot, and the documentation was not that helpful in this particular matter.
What troubles me most are the [special rules that apply to DllMain](https://learn.microsoft.com/en-au/windows/win32/dlls/dynamic-link-library-best-practices?redirectedfrom=MSDN#general-best-practices), such as ["you cannot wait for threads to finish"](https://stackoverflow.com/questions/35828004/waitforsingleobject-for-thread-object-does-not-work-in-dll-unload/35833437#35833437).
Contributor guide
Assessment
This issue has not been assessed yet.