Boost logo

Boost Users :

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


There is no exception management in the function. Its code based on C and
migrated to C++. I can wrapper it with try catch.

 

Vadim.

 

From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Ovanes Markarian
Sent: Monday, December 07, 2009 19:34
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Newbie question

 

Is that function exception-safe?

Regards,

Ovanes

 

 

 

On Mon, Dec 7, 2009 at 6:00 PM, Vadim Ryvchin <vadimryv_at_[hidden]> wrote:

I can't change the function so it will check the token, that is my main
problem. I want to be able to stop the execution from outside the function.

 

Thank you anyway,

Vadim.

 

From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Ovanes Markarian
Sent: Monday, December 07, 2009 18:09
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Newbie question

 

I would suggest to introduce a Cancellation Token as parameter to both
functions. If one function becomes ready it sets the cancelation flag to
true, so that other function can check it and exit. In the most simple case
it can be a volatile boolean value passed by reference to both functions.

 

 

Hope that helps,

Ovanes

 

On Mon, Dec 7, 2009 at 1:44 PM, Vadim Ryvchin <vadimryv_at_[hidden]> 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.

 

_______________________________________________
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