我想在我的项目中使用 windows miniFilter。
我看过微软的文档,但似乎很难理解。
我还阅读了 miniFilters 的 GitHub 示例,但它们并没有为所有内容提供解释,因为我想了解我写的内容,而不仅仅是复制和粘贴。是否有任何适合初学者的网站可以帮助我了解更多信息?
我正在为我的项目构建一个多线程服务器.
我正在使用条件变量和锁.
我将条件变量cv作为全局,将mutex _mtxReceivedMessages作为类成员.
这是等待用户消息的功能:
void Server::handleReceivedMessages()
{
while (1)
{
std::unique_lock<std::mutex> lck(_mtxReceivedMessages);
while (_queRcvMessages.size() == 0) cv.wait(lck); // As long as there are 0 messages in the queue
}
}
Run Code Online (Sandbox Code Playgroud)
这是调用通知cv的函数:
void Server::addReceivedMessage(ReceivedMessage* msg)
{
_queRcvMessages.push(msg); // Adds the message to the queue
cv.notify_all(); // Unlockes all locked functions
}
Run Code Online (Sandbox Code Playgroud)
问题是,如果我尝试在函数handleReceivedMessages等待时关闭程序(在调用函数addReceivedMessage之前)程序崩溃,
但是如果我删除该行:
while (_queRcvMessages.size() == 0) cv.wait(lck); // As long as there are 0 messages in the queue
Run Code Online (Sandbox Code Playgroud)
程序退出就好了.
程序崩溃:Nuvola.exe中0x7748507C(ntdll.dll)的未处理异常:0xC000000D:将无效参数传递给服务或函数.
可能是什么问题?