Re[2]: std::thread, std::condition_variable и dll
От: Doom100500 Израиль  
Дата: 14.06.21 04:50
Оценка:
Здравствуйте, Videoman, Вы писали:

V>Здравствуйте, Doom100500, Вы писали:


V>Можно конечно разбираться что конкретно происходит при выходе (скорее всего deadlock), но в общем случае в DLL Main нельзя использовать функции из других системных DLL.

V>Вот что написано в документации!
V>

V>Because DLL notifications are serialized, entry-point functions should not attempt to communicate with other threads or processes. Deadlocks may occur as a result.

V>The entry-point function should perform only simple initialization or termination tasks. It must not call the LoadLibrary or LoadLibraryEx function (or a function that calls these functions), because this may create dependency loops in the DLL load order. This can result in a DLL being used before the system has executed its initialization code. Similarly, the entry-point function must not call the FreeLibrary function (or a function that calls FreeLibrary) during process termination, because this can result in a DLL being used after the system has executed its termination code.

V>А все эти вещи могут возникнуть в вашем коде.

Был бы deadlock, было бы понятно, но поток (std::thread) завершается молча, и создаётся впечатление, что всё работает правильно. Только после добавления диагностических логов возник вопрос.
Спасибо за внимание
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.