Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Bram van Kampen18-Mar-16 17:57
Bram van Kampen18-Mar-16 17:57 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Richard MacCutchan18-Mar-16 22:57
mveRichard MacCutchan18-Mar-16 22:57 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Bram van Kampen19-Mar-16 13:41
Bram van Kampen19-Mar-16 13:41 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Richard MacCutchan19-Mar-16 22:09
mveRichard MacCutchan19-Mar-16 22:09 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Bram van Kampen22-Mar-16 13:34
Bram van Kampen22-Mar-16 13:34 
AnswerRe: Vagarities of Multiple threads in Windows Pin
leon de boer19-Mar-16 21:35
leon de boer19-Mar-16 21:35 
GeneralRe: Vagarities of Multiple threads in Windows Pin
Bram van Kampen22-Mar-16 13:33
Bram van Kampen22-Mar-16 13:33 
GeneralRe: Vagarities of Multiple threads in Windows Pin
leon de boer25-Mar-16 23:57
leon de boer25-Mar-16 23:57 
You said

"Furthermore it is quite inefficient as a synchronisation method. It typically means burning CPU Cycles waiting for something to happen. The better way is to put the thread to sleep, by the use of something like WaitForSingleObject()."

First the method is not necessarily inefficient (it can be a lot faster than alternatives) and you can not use WaitForSingleObject to solve the problem in any way because the problem is you don't know when the change will occur. WaitForSingleObject hangs around and waits when you know a CHANGE OF SOMETHING MUST OCCUR. That function is of no use for the sort of problem you are dealing with it is used more for asynchronous transfers. The next part is correct.

Sychronization is the issue and CriticalSections, Mutexes and Semaphores are the only real way to get around it but THEY CAN BE EXTREMELY INEFFICIENT. A well used volatile with careful coding around the variable can save lots of messing around with synchronization in the simplest situations which is often 90% of cases. It is however NO GUARANTEED FIX you still have to understand what your threads are doing with memory access, the when where and how factors.

This statement by you => "All worked to perfection when I built a Skeleton Application, of essentially blank Dialogs.
Started to fill in Details, Controls, etc, and the App Clock Ticks are no longer recognised."

That tends to suggest you have a synchronization issue because your message posts are going AWL. The app clock tick should be picked up and delivered by DispatchMessage and it can't get lost unless something is going wrong with the memory .... It is delivered to a window based on handle. I would start with following the code for that tick message because it should be dead easy to put a watch on and see where it is getting dispatched to and why it is failing.
In vino veritas

QuestionOpenGL control on split MFC form Pin
Member 1228273814-Mar-16 10:08
Member 1228273814-Mar-16 10:08 
AnswerRe: OpenGL control on split MFC form Pin
Richard MacCutchan14-Mar-16 23:48
mveRichard MacCutchan14-Mar-16 23:48 
QuestionDefault argument for DISP_FUNCTION_ID Pin
Member 1214953910-Mar-16 16:44
Member 1214953910-Mar-16 16:44 
AnswerRe: Default argument for DISP_FUNCTION_ID Pin
Bram van Kampen16-Mar-16 15:45
Bram van Kampen16-Mar-16 15:45 
QuestionBoth EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
ForNow10-Mar-16 10:19
ForNow10-Mar-16 10:19 
AnswerRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
Bram van Kampen10-Mar-16 14:39
Bram van Kampen10-Mar-16 14:39 
GeneralRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
ForNow10-Mar-16 15:20
ForNow10-Mar-16 15:20 
GeneralRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
Richard MacCutchan11-Mar-16 3:52
mveRichard MacCutchan11-Mar-16 3:52 
AnswerRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
Richard MacCutchan10-Mar-16 21:21
mveRichard MacCutchan10-Mar-16 21:21 
AnswerRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
leon de boer19-Mar-16 21:50
leon de boer19-Mar-16 21:50 
GeneralRe: Both EnumchildWindows and GetWindow return NULL for a ChildWindow modeless dialogbox Pin
ForNow20-Mar-16 12:45
ForNow20-Mar-16 12:45 
QuestionHow Much of WM_USER+X is used by MFC Pin
Bram van Kampen9-Mar-16 14:14
Bram van Kampen9-Mar-16 14:14 
AnswerRe: How Much of WM_USER+X is used by MFC Pin
Jochen Arndt9-Mar-16 21:38
professionalJochen Arndt9-Mar-16 21:38 
AnswerRe: How Much of WM_USER+X is used by MFC Pin
Richard MacCutchan9-Mar-16 22:17
mveRichard MacCutchan9-Mar-16 22:17 
GeneralRe: How Much of WM_USER+X is used by MFC Pin
Bram van Kampen10-Mar-16 14:03
Bram van Kampen10-Mar-16 14:03 
GeneralRe: How Much of WM_USER+X is used by MFC Pin
Richard MacCutchan10-Mar-16 21:15
mveRichard MacCutchan10-Mar-16 21:15 
GeneralRe: How Much of WM_USER+X is used by MFC Pin
Jochen Arndt10-Mar-16 21:38
professionalJochen Arndt10-Mar-16 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.