Hi, i working on an application using boost::thread. The application cretaes a thread, then put in wait state. Based on the user input i want the thread eitjer to move it to run state or cancel the thread. As i am newbie to boost thread, i couldn't find any documentation or working example that satisfies my requiremnt. So someone can help me out?? Rgds, Janardhan
(janardhan.guptha@efi.com) wrote:
Hi, i working on an application using boost::thread. The application cretaes a thread, then put in wait state.
Do you mean, you are waiting on a condition variable?
Based on the user input i want the thread eitjer to move it to run state or cancel the thread.
When the condition is fullfilled, your thread will run. If the condition signals cancelation time you should exit your thread.
As i am newbie to boost thread, i couldn't find any documentation or working example that satisfies my requiremnt. So someone can help me out??
Thread cancellation is a complicated topic and is not yet covered by boost thread. That does not mean, you cannot use it. You should try to design your application in a way that can do without cancellation support. Some even think foreign cancellation of threads is bad design. If you are new to threading however I would recommend to read something about the topic beforehand. Getting a book about the pthreads library (a C library) might be very valuable, since the boost thread uses quite a couple of ideas from it. Regards Roland
On Feb 7, 2004, at 6:11 AM, Roland wrote:
Thread cancellation is a complicated topic and is not yet covered by boost thread. That does not mean, you cannot use it. You should try to design your application in a way that can do without cancellation support. Some even think foreign cancellation of threads is bad design.
Not only is it not supported by boost, POSIX thread cancellation _does_not_work_ on any available platform. http://www.slamb.org/svn/repos/projects/cancellation_tests/ Eight different platforms, and none of them have acceptable cancellation behavior for C++ code or for interacting with signals. It's possible (likely) I've messed up some of my tests, but not all. And I tested the latest version of all these platforms; older versions are even worse. Good luck. Scott
participants (3)
-
janardhan.gupthaļ¼ efi.com
-
Roland
-
Scott Lamb