|
|
Home » U++ Library support » U++ MT-multithreading and servers » IsFinished() for CoWork
IsFinished() for CoWork [message #14579] |
Mon, 03 March 2008 23:58  |
kodos
Messages: 111 Registered: March 2008
|
Experienced Member |
|
|
Hi,
I think that a function IsFinished() would be realy usefull in the CoWork class.
CoWork.h
...
bool IsFinished();
...
bool IsFinished() { return true; }
//In the singlethreaded version
CoWork.cpp
bool CoWork::IsFinished() {
Pool &p = pool();
p.lock.Enter();
bool retVal = todo == 0;
p.lock.Leave();
return retVal;
}
|
|
|
|
|
|
|
|
Re: IsFinished() for CoWork [message #14647 is a reply to message #14634] |
Wed, 05 March 2008 19:44  |
kodos
Messages: 111 Registered: March 2008
|
Experienced Member |
|
|
cbpporter wrote on Wed, 05 March 2008 09:54 |
The point is that only you main thread can update the GUI. If you're callback belongs to the main thread, then there is no problem with it. Create the callback member function in you main window class for example, and everything will work fine.
Did you look over reference/GuiMT example? It creates a callback at the end of the thread with Divisors::ShowResult, which then does the updating.
|
Ah, OK thank you, I didn't know that this is possible. I thought if you call a callback in an other thread, it will be called in the context of that thread.
|
|
|
Goto Forum:
Current Time: Fri May 09 11:26:18 CEST 2025
Total time taken to generate the page: 0.01154 seconds
|
|
|