bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is Thread::terminate() protected?


From: Byrial Jensen
Subject: Re: Why is Thread::terminate() protected?
Date: Thu, 5 Aug 2004 09:14:05 +0200

Curtis Magyar wrote:
> On Wed, 2004-08-04 at 14:47 +0200, Byrial Jensen wrote:
>> Hallo,
>> 
>> I am using threads in CommonC++ and have a situation
>> where I want one thread to create another thread and
>> later terminate it again. I thougt it would be possible
>> to do it as outlined in the example code below:
> 
> I generally haven't had very much luck doing what you're trying to do.
> I've attached a runnable test app based on your code that works more
> like the approach I've had great success with.

Thank you,

Unfortunately I cannot use your approach where the thread to
be deleted checks a delete-flag at appropiate times, because
my threads to be terminated are instances of class TCPSocket,
and they are blocked in a SocketPort constructor doing a accept(2)
system call when I want them to terminate (and release their sockets).
Therefore I need to be able to terminate them from another thread.

I still wonder why Thread::terminate() is protected. The manual
says: "Used by another thread to terminate the current thread."
 - how should that be done when the function is not public?

Best regards,
Byrial Jensen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]