Boost logo

Boost Users :

Subject: Re: [Boost-users] Newbie question
From: Vadim Ryvchin (vadimryv_at_[hidden])
Date: 2009-12-07 12:02:59


I can get the executed function as parameter so no way for me to use global
or shared variable. I'm looking for solution using thread reference only.

Thank you anyway,
Vadim.

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Nigel Rantor
Sent: Monday, December 07, 2009 17:49
To: boost-users_at_[hidden]
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.

The solution will depend on your function.

You imply that *maybe* the function is determining when to stop based on
a global shared variable, if this is the case then you may be out of
luck unless you can change the function. No way to tell without knowing
what is going on in your code.

Please post some code.

   n
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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