Boost Users :
Subject: [Boost-users] Threading question
From: Davies, John (john.davies_at_[hidden])
Date: 2013-09-26 19:16:54
I have the following code and it terminates as expected. When I call the destructor it interrupts the thread.
But if I change the this_thread::sleep to this_thread::yield the join() never happens and the program hangs.
I must be misunderstanding yield. But I really don't want a sleep if possible.
// Terminate the thread
unsigned int receivedSize;
unsigned int priority;
// Process all messages in the queue
while(inputMessageQueue->try_receive(buffer, queueMaximumMessageSize, receivedSize, priority))
BaseMessage * msg = reinterpret_cast<BaseMessage*>(buffer);
// Give other threads a chance to run
// This is also an interruption point
Home Respiratory Care
Philips Home Healthcare Solutions
1740 Golden Mile Highway
Monroeville, PA 15146
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net