async-rs/async-std

async-std in Windows cdylib dlls (LoadLibrary/FreeLibrary startup/cleanup)

Trolldemorted opened this issue · 1 comments

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, such as "you cannot wait for threads to finish".