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 » Basic MT queries
Re: Basic MT queries [message #28875 is a reply to message #28874] Tue, 21 September 2010 18:46 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

281264 wrote on Tue, 21 September 2010 18:03

Honza:

Many thanks. Fine explanation. What is Wait() function for?

Javier

Wait() is for situations where you need to block the program until a given thread finishes (e.g. because you need it's result before your program can continue).

Example:
Thread t1,t2;
//start threads to do some work in parallel
t1.Run(fn1); // do first half of work
t2.Run(fn2); // do second half of work
// wait till both finish so you can process results
t1.Wait();
t2.Wait();
// now you can continue work that needs both threads to be finished ...

Notice that it doesn't matter in which order the threads finish. If you call Wait() on thread that has already finished, it should return immediately.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: smtp problem
Next Topic: GLCtrl and multithreading
Goto Forum:
  


Current Time: Thu May 09 15:18:34 CEST 2024

Total time taken to generate the page: 0.02366 seconds