Click here to Skip to main content
15,916,949 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++ crashes... Pin
Toni7817-Jun-03 19:17
Toni7817-Jun-03 19:17 
GeneralMulti-line listctrl Pin
pranavamhari17-Jun-03 4:51
pranavamhari17-Jun-03 4:51 
GeneralRe: Multi-line listctrl Pin
Iain Clarke, Warrior Programmer17-Jun-03 5:20
Iain Clarke, Warrior Programmer17-Jun-03 5:20 
GeneralAccelerator stored in DLL Pin
SD317-Jun-03 4:03
SD317-Jun-03 4:03 
GeneralRe: Accelerator stored in DLL Pin
basementman17-Jun-03 5:25
basementman17-Jun-03 5:25 
GeneralRe: Accelerator stored in DLL Pin
SD318-Jun-03 2:36
SD318-Jun-03 2:36 
GeneralRe: Accelerator stored in DLL Pin
Iain Clarke, Warrior Programmer17-Jun-03 5:46
Iain Clarke, Warrior Programmer17-Jun-03 5:46 
GeneralResource Access in Multiple Timers in Single thread Pin
RCM17-Jun-03 4:03
RCM17-Jun-03 4:03 
Hi,
I have a dialog based MFC application which has 2 timers with same interval (say 5 mins) accessing a single resource. A structure instance which is a member variable of the App class is being updated in one timer and the same structure instance is being used in another timer. ( Typically, the memory resource is being accessed for write in one timer callback and for read in another timer callback ). The code snippet something is like this,

CMyFrameDlg::TimerCallback1(...)
{
...
theApp.m_Struct.nVar1 = 10;
theApp.m_Struct.szVar2 = "test";
...
...
}

CMyFrameDlg::TimerCallback2(...)
{
...
...
localnVar = theApp.m_Struct.nVar1;
localszVar = theApp.m_Struct.szVar2;
...
}
The 2 timers get called simultaneously. Issue is, that the values dont get reflected properly in timer2 and while the struct is being accessed in timer2 it is being updated simulataneously in timer1. Both timers belong to the same Thread.

1.) I need to update the same resource in one timer and use it for some other purpose in the second timer. Is it possible ?

2.) I also have certain WM_.. messages posted from another thread to this thread on which a callback gets invoked. And this callback also accesses the same structure instance, but the values are not properly updated. Why is it so ?

Point is.. accessing the same resource ( memory) in multiple timers of the same thread. And also accessing same resource in multiple callbacks of the same thread (like user defined WM_message callbacks). Is there any restriction or way to do that ?

Anxiously Waiting for a reply Unsure | :~

Cheers

Raja

GeneralRe: Resource Access in Multiple Timers in Single thread Pin
Harsha Gopal17-Jun-03 5:21
Harsha Gopal17-Jun-03 5:21 
GeneralRe: Resource Access in Multiple Timers in Single thread Pin
harish kota17-Jun-03 18:41
harish kota17-Jun-03 18:41 
GeneralRe: Resource Access in Multiple Timers in Single thread Pin
RCM17-Jun-03 20:09
RCM17-Jun-03 20:09 
GeneralRe: Resource Access in Multiple Timers in Single thread Pin
Harsha Gopal18-Jun-03 6:08
Harsha Gopal18-Jun-03 6:08 
Generalabout message reflexion ... Pin
Maximilien17-Jun-03 3:58
Maximilien17-Jun-03 3:58 
GeneralRe: about message reflexion ... Pin
Ryan Binns17-Jun-03 4:13
Ryan Binns17-Jun-03 4:13 
QuestionBreakpoint with condition? Pin
Brian van der Beek17-Jun-03 3:17
Brian van der Beek17-Jun-03 3:17 
AnswerRe: Breakpoint with condition? Pin
Maximilien17-Jun-03 3:38
Maximilien17-Jun-03 3:38 
GeneralRe: Breakpoint with condition? Pin
Brian van der Beek17-Jun-03 3:44
Brian van der Beek17-Jun-03 3:44 
GeneralRe: Breakpoint with condition? Pin
peterchen17-Jun-03 3:46
peterchen17-Jun-03 3:46 
GeneralOracle Form or Report from a Visual c++ Pin
Felix_br17-Jun-03 3:09
Felix_br17-Jun-03 3:09 
Generalplease help! fast simple question Pin
wickedclownz17-Jun-03 2:29
wickedclownz17-Jun-03 2:29 
GeneralRe: please help! fast simple question Pin
WoutL17-Jun-03 2:35
WoutL17-Jun-03 2:35 
GeneralRe: please help! fast simple question Pin
WoutL17-Jun-03 2:59
WoutL17-Jun-03 2:59 
GeneralRe: please help! fast simple question Pin
David Crow17-Jun-03 2:54
David Crow17-Jun-03 2:54 
Generalok thanks, what about this? Pin
wickedclownz17-Jun-03 11:35
wickedclownz17-Jun-03 11:35 
GeneralRe: ok thanks, what about this? Pin
David Crow18-Jun-03 2:52
David Crow18-Jun-03 2:52 

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.