Thank you, process solution is really nice and that what I choose to do. Thanks, Vadim. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Roland Bock Sent: Tuesday, December 08, 2009 10:15 To: boost-users@lists.boost.org Subject: Re: [Boost-users] Newbie question Vadim Ryvchin wrote:
Hello,
I have a problem with interruption of threads. I have one function that I want to run in two different threads with different parameters. When one of the function's instances finishes it stops the other instance. I can't change the function's code, but I can write wrapper to it. My problem is in stopping the other thread. Using timed_join I find which thread is finished, but I can't find a good solution for stopping the second one. How should I use interrupt method correctly or suggest me for correct thread stopping function. BTW, I can't just leave the other thread to run, it's very high CPU consumer.
Thank you all.
Hi, with no way to change the functions and no global variables to indicate that they should stop, I see two options: a) try to do some hacker's magic and manipulate the memory of the function in such a way that it stops but not crashes (the sheer thought of that approach makes me shiver in horror) b) start the functions in separate processes. Stopping the second process is much easier. Of course, then you still could have problems with open files and so on. HTH Roland _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users