0
votes

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?

1
Do you get errors at runtime or merely behavior you didn't expect?ildjarn
No error, just the function specified in async_wait() does not run.Dave
Try building in debug and see what happens if you run it from outside VSAlex Kremer
@Dave : Sounds like you have an uninitialized object somewhere in your code.ildjarn
@Dave : I mean a default-initialized object of scalar or POD type. Debug builds (or, potentially, builds whose process is launched with VC++'s debugger attached) typically zero-initialize these while release builds do not.ildjarn

1 Answers

3
votes

(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.