Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » MT again
Re: MT again (SOLVED!) [message #24029 is a reply to message #24028] Sat, 19 December 2009 11:55 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
mdelfede wrote on Fri, 18 December 2009 06:51

The problem was that IsOpen() just checks that the thread was STARTED right, not if the thread is still active.
To check for it, I added a new variable set inside the thread (inThread).



Well, I have spent some time thinking about the issue and came to the conclusion that IsOpen behaviour is in fact correct:

Even if thread is finished (returns from the thread routine), its OS representation still exists until the last reference to the thread is closed.

For example, in such situation, call to Wait returns immediately.

This behaviour is in fact required for correct thread synchronisation - it is always possible that thread finishes quick, but you still need to know that it has started successfully.

I was also thinking about adding IsRunning method, but for now I am against it - such status is very temporal thing, I am afraid that such method is invitation for race conditions to emerge.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HttpQuery - not working?
Next Topic: CGI-BIN bug with Apache Server
Goto Forum:
  


Current Time: Sat May 11 23:04:30 CEST 2024

Total time taken to generate the page: 0.03363 seconds