Dave
Dave

Reputation: 1334

boost::asio only works when run within Visual Studio

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?

Upvotes: 0

Views: 261

Answers (1)

ildjarn
ildjarn

Reputation: 62975

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

Upvotes: 3

Related Questions