3 ms·
Wait until you learn about (dynamically-loaded) libraries that start up worker threads and stuff without any notification. You do your stuff with them, then cal
by Joker_vD 5y ago
Wait until you learn about (dynamically-loaded) libraries that start up worker threads and stuff without any notification. You do your stuff with them, then call FreeLibrary and suddenly some random thread crashes because its text is no longer mapped and brings your whole program down. Fun stuff!
- matheusmoreira 5y agoJesus. I wonder how much time it took to debug that... Libaries shouldn't do anything unless called explicitly. Even when called, they should cede as much control as possible. They should probably be exposing the concurrent functions so the caller can decide how to thread them... Every time a library decides to make things easy for the user it leads to insane problems like these.
- Joker_vD 5y agoNah, it's a rather basic problem and the solution is well known: do another LoadLibrary on the already loaded library. Of course, then you need a FreeLibraryAndExitThread... [0] And the posts following [0] (you can see them at the bottom of the page in the "Read Next" section) explain more of the context. All this stuff is there because of the built-in threading support in COM which, arguably, was pretty convoluted for some rather strange reasons ― what's the point of such precise RAII-ing of the DLLs? I guess the address space was really precious back then or something. [0] https://devblogs.microsoft.com/oldnewthing/20131105-00/?p=2733 https://devblogs.microsoft.com/oldnewthing/20131105-00/?p=27...
- __turbobrew__ 5y agoMix in some signals and you are on the fast track to debugging purgatory.