|
Boost Users : |
Subject: Re: [Boost-users] How to detect thread kill?
From: Rune Lund Olesen (rune.olesen_at_[hidden])
Date: 2011-08-31 16:32:13
You could make a structure on the heap to track which threads you kill
yourself and which you think is alive - i imagine.
Each thread should then update said structure when done (in a
threadsafe way needless to say).
If a thread then is gone and your tracker thinks its alive you can
conclude something else killed it -almost in a portable way i guess.
Regards
On Wed, Aug 31, 2011 at 7:19 PM, Samvel Khalatyan
<samvel.khalatyan_at_[hidden]> wrote:
> Thank you Chris.
> I have an application that starts many threads to process input files. The
> application runs on Linux and sometimes threads get killed. This leads to
> segmentation faults and termination without memory clean-up, etc. So, I
> thought of the way to at least catch such cases and cleanly quit the
> application.
> Samvel.
> On Wed, Aug 31, 2011 at 11:52 AM, Chris Cleeland <chris.cleeland_at_[hidden]>
> wrote:
>>
>> On Wed, Aug 31, 2011 at 11:03 AM, Samvel Khalatyan
>> <samvel.khalatyan_at_[hidden]> wrote:
>> > There is a number of standard ways to interrupt thread from within an
>> > application with library tools.
>>
>> Not in a portable fashion.
>>
>> > However, is there a way to detect if one of the running threads was
>> > killed
>> > with system tools and thread is not available any more?
>>
>> I'm not aware of any consistent way of killing a thread with system tools.
>>
>> Since there is no portable way to do what you're asking, I can't
>> imagine that there's a portable way to detect the effect, either.
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> 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