|
PowerBASIC Forums
![]() Programming
![]() XP vs 95/98 - threads - slow, slow, slow ??? (Page 2)
|
This topic is 2 pages long: 1 2 |
next newest topic | next oldest topic |
| Author | Topic: XP vs 95/98 - threads - slow, slow, slow ??? |
|
Chris Boss Member |
Dominic, The problem with PostMessage was this: The tests I ran were where the thread would calculate coordinates When I posted the messages this is what happened: The main GUI thread would get a message which requested an image Windows waits until no messages are pending before WM_PAINT What happened when I posted messages, the GUI thread would draw When I switched to using SendMessage which forced a context switch Because posting a message doesn't require the message to be The use of SendMessage forces a context switch so you have more The EZGUI program noted above, displays two different animations My comments are based on an actual real life test and the need EZGUI 3.0 does support posting a message from a thread, but it I am not concerned about any "recommended" method in books, but I did do a good bit of research into using threads before deciding ------------------ IP: Logged |
|
Dominic Mitchell Member |
Posting a series of messages to a queue will cause a backlog. Keyboard and mouse messages are good examples. Your problem was thread synchronization. By switching from PostMessage to SendMessage you synchronize the threads. The sending thread (worker) is put to sleep (it does nothing) until SendMessage returns. This is not a case of the thread going too fast. The threads were not synchronized. quote: That's an advantage not a disadvantage. quote: Sorry, but that just ain't so. As soon as you use SendMessage between two threads, you have lost control. If the receiving thread hangs, the sender will never wake up. You want control, use SendMessageTimeout. ------------------ IP: Logged |
|
Michael Mattias Member |
GetQueueStatus is the call I could not find. Thank you. IP: Logged |
This topic is 2 pages long: 1 2 All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.