Boost logo

Boost Users :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2005-02-09 17:06:25


The reason it is not implemented is likely because canceling a thread
can be unsafe - there is no stopping it from canceling in the middle
of a malloc()/new (in win32, at least) and leaking memory.

Have you tried having your threads wait on a condition to be canceled?

On Wed, 09 Feb 2005 13:26:01 +0000, Chris Coleman <cqc_at_[hidden]> wrote:
> Hi,
>
> I know at present that the Boost Threads implementation does not provide
> a terminate() / cancel() function, but the documentation suggests that
> work is in progress to implement this feature once a safe and portable
> way is found. I was just wondering whether this will appear soon in
> future releases, or if it is likely to be some time?
>
> At present I can kill a thread internally by simply throwing an
> exception and not catching it. But externally I cannot.
>
> I have a thread pool server I built some time ago using the pthread API
> and I'm porting it to use Boost Threads. The server has add() and
> remove() thread methods. Within the remove function under the pthread
> implementation I could call pthread_cancel(thrID) and that would be
> that, Obviously I cant call thread.cancel() as I'd like here and was
> wondering if there were any simple ways to signify that a particular
> thread should terminate?
>
> Cheers
> Chris
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses, which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Cory Nelson
http://www.int64.org

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