I've just encountered a weird and devastating problem that I couldn't find any information about it anywhere.
asio::steady_timer timer(m_context);
This asio::steady_timer
works perfectly fine if I'm building it as an EXE, but if it's built as a DLL it will be stuck waiting for WaitForSingleObject
(in win_thread.ipp
file, line 106) whenever initialize a asio::steady_timer
, please take a look at the picture below.
This DLL is just an empty project, it only includes the asio.hpp
file. I've found this_article about a problem that might be relevant, but still found no way to debug or fix this.
Am I doing something wrong, or is this the library's bug?
Thanks for your time!
This was solved by making these two class members or global variables and not initializing them in the entry point of the DLL.
asio::io_context context;
asio::steady_timer timer(context);