boost::asio 仅在 Visual Studio 中运行时有效
我正在从辅助(即非 GUI)工作线程使用 boost::asio::io_service 和 boost::asio::deadline_timer 。当程序在 Visual Studio (2010) 中运行时,这可以完美地工作。但是,当我在 Visual Studio 之外运行发布可执行文件时,async_wait()/run() 组合似乎没有执行任何操作。
我已经确认 run() 确实会阻塞。我现在还确认调试可执行文件工作正常,只是发布可执行文件不起作用(即 async_wait() 中指定的函数未运行)。
也许有一些项目设置,一些我需要禁用的优化,或者其他什么?
I am using boost::asio::io_service and boost::asio::deadline_timer from a secondary (i.e. non-GUI) worker thread. This works perfectly when the program is run from within Visual Studio (2010). However, when I run the release executable outside of Visual Studio, the async_wait()/run() combination doesn't seem to do anything.
I have confirmed that run() does indeed block. I have also now confirmed that the debug executable works fine, it is only the release executable that does not work (i.e. the function specified in async_wait() is not run).
Perhaps there is some project setting, some optimization I need to disable, or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(从评论中重新发布,以便可以将问题标记为已回答)
您可能在某处有一个未初始化的变量,即标量或 POD 类型的默认初始化对象。
(Reposting from comment so the question can be marked as answered)
You probably have an uninitialized variable somewhere, i.e. a default-initialized object of scalar or POD type.