question about interprocess_condition::timed_wait

I'm trying to use interprocess_condition::timed_wait without success. I never get the timeout in my code. I think I don't understand at all how posix_time works. My code is the following: ptime t = boost::posix_time::microsec_clock::local_time(); ptime timeout = t + milliseconds(1000); scoped_lock<interprocess_mutex> lock(InterprocessMutex, timeout); if (get_shared_data(lock).m_message) if (!InterprocessCondition.timed_wait(lock, timeout)) { // handle timeout } Is that ok? Thanks.

Isaac Lascasas wrote:
I'm trying to use interprocess_condition::timed_wait without success. I never get the timeout in my code. I think I don't understand at all how posix_time works. My code is the following:
ptime t = boost::posix_time::microsec_clock::local_time(); ptime timeout = t + milliseconds(1000);
scoped_lock<interprocess_mutex> lock(InterprocessMutex, timeout); if (get_shared_data(lock).m_message) if (!InterprocessCondition.timed_wait(lock, timeout)) { // handle timeout }
Is that ok?
Use universal time. That issue is missing in the documentation and it will be fixed in the next release.
Thanks.
Ion

Worked like a charm, thank you. 2009/2/25 Ion Gaztañaga <igaztanaga@gmail.com>
Isaac Lascasas wrote:
I'm trying to use interprocess_condition::timed_wait without success. I never get the timeout in my code. I think I don't understand at all how posix_time works. My code is the following: ptime t = boost::posix_time::microsec_clock::local_time(); ptime timeout = t + milliseconds(1000); scoped_lock<interprocess_mutex> lock(InterprocessMutex, timeout); if (get_shared_data(lock).m_message) if (!InterprocessCondition.timed_wait(lock, timeout)) { // handle timeout } Is that ok?
Use universal time. That issue is missing in the documentation and it will be fixed in the next release.
Thanks.
Ion _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Ion Gaztañaga
-
Isaac Lascasas