Home » U++ Library support » U++ MT-multithreading and servers » how to stop a thread that is waiting, e.g., listen()
Re: how to stop a thread that is waiting, e.g., listen() [message #11835 is a reply to message #11802] |
Thu, 27 September 2007 13:20   |
 |
tvanriper
Messages: 85 Registered: September 2007 Location: Germantown, MD, USA
|
Member |
|
|
Sorry... I have mostly worked with Windows programming, where the term 'signal' takes on a slightly different meaning, I think. At the very least, I meant the word in a far more generic way than I think you took it.
I can't really speak too clearly on POSIX-oriented programming, and I still need to peek a little more closely at how Ultimate++ handles threading in general, but while there might be commands to kill a thread, that normally means you're ending the thread before it has had a chance to clean up. Especially for long-running applications, this is not a good idea.
In general, regardless of platform, you want to somehow tell the thread, while it's running, that it should stop running, so it can clean itself up. That's all I'm trying to say.
In the Windows world, you do that through an event/signal.
I get the impression that, in the POSIX world, a signal interrupts the flow of the thread... that isn't what I'm aiming for. At least, I don't think it's what I'm aiming for... but again, I am not very experienced in POSIX. I could be completely wrong.
Somehow, while your thread waits for information to arrive on the socket, something tells the thread that it can stop waiting, and handle the network information. That same mechanism should also be able to provide a way of telling your thread that it can stop waiting, and start handling some other kind of information (in this case, checking a variable to see if the thread should quit). While I know how to do such a thing in Windows, I do not know how to do such a thing with POSIX, and I'm not entirely sure (yet) how Ultimate++ handles it... but I expect you could probably figure it out by examining the Ultimate++ code.
|
|
|
 |
 |
how to stop a thread that is waiting, e.g., listen()
By: bonami on Wed, 26 September 2007 11:40
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: tvanriper on Wed, 26 September 2007 13:05
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Thu, 27 September 2007 10:57
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: tvanriper on Thu, 27 September 2007 13:20
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: tvanriper on Thu, 27 September 2007 13:43
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Fri, 28 September 2007 05:13
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: tvanriper on Sat, 29 September 2007 14:46
|
 |
 |
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Tue, 16 October 2007 11:59
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: mirek on Wed, 17 October 2007 19:16
|
 |
 |
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Fri, 19 October 2007 11:52
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Mon, 22 October 2007 11:47
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
|
 |
 |
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Wed, 24 October 2007 04:20
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: mirek on Sun, 11 November 2007 18:49
|
 |
|
Re: how to stop a thread that is waiting, e.g., listen()
By: bonami on Mon, 12 November 2007 02:19
|
Goto Forum:
Current Time: Fri May 09 22:46:33 CEST 2025
Total time taken to generate the page: 0.02775 seconds
|