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 » Wait for other Threads
Re: Wait for other Threads [message #46573 is a reply to message #46570] Thu, 02 June 2016 16:41 Go to previous messageGo to previous message
funky1221 is currently offline  funky1221
Messages: 3
Registered: May 2016
Junior Member
I try the GuiLock learned from the reference/GuiLock.
Change to the below but still no response and like be in the loop.

But if removed "while(Thread().GetCount());", it worked!

But intfile still 0, why ?

PromptOK show intfile prior to Grid that show file list. why Threads wait not work ?


void testU::PushRun()
{
	grid1.Clear();
	intfile=0;
	Thread().Run(THISBACK1(Searchfile,"C:"));
	Thread().Run(THISBACK1(Searchfile,"E:"));
	
	
	while(Thread().GetCount());
		
	String s = "Total " + AsString(intfile) + " Files";
	PromptOK(s);
}
void testU::Searchfile(String path)
{
	
	FindFile fs;
	String file = edit;
	file = path + "\\" + file;
	if(fs.Search(file))
	{

		do
		{
		    Sleep(1);        // 
		    GuiLock __;      // New Add instead of INTERLOCKED

		    Time t(fs.GetLastWriteTime());
		    String lstime = Format("%",t);
		    String fullname = fs.GetPath();
			
		    grid1.Add(fullname,lstime);
		    intfile++;
			
			
		}while(fs.Next());
	}
	
}
  • Attachment: testU.7z
    (Size: 1.24KB, Downloaded 302 times)
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to use the TcpSocket::Get?
Next Topic: skylark meet strange problem
Goto Forum:
  


Current Time: Fri Jun 27 17:04:12 CEST 2025

Total time taken to generate the page: 0.04151 seconds