Click here to Skip to main content
15,914,905 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionATL 7: How to _Module.GetModuleInstance()? Pin
Binky3-Dec-02 5:49
Binky3-Dec-02 5:49 
AnswerRe: ATL 7: How to _Module.GetModuleInstance()? Pin
geo_m4-Dec-02 3:25
geo_m4-Dec-02 3:25 
GeneralNeed help in firing event from second thread using shared variable!! Pin
bahruddina3-Dec-02 5:29
bahruddina3-Dec-02 5:29 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
geo_m5-Dec-02 1:14
geo_m5-Dec-02 1:14 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
bahruddina6-Dec-02 20:16
bahruddina6-Dec-02 20:16 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
geo_m6-Dec-02 22:34
geo_m6-Dec-02 22:34 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
bahruddina7-Dec-02 6:34
bahruddina7-Dec-02 6:34 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
geo_m7-Dec-02 7:04
geo_m7-Dec-02 7:04 
You are welcome Smile | :)

This CPU burning is probably again done by the Run function and some more around -> if you minimize it to the smallest possible workflow you get something like:

while( MayIContinue() )<br />
{<br />
  if( fire ) {fire_it();};<br />
}


if there is nothing to fire, your thread just dance in the endless loop, and this causes the CPU cycles burning. Better alg. is to have a event, signalled when there is something to fire - then where you set the fire variable to true, you will do SetEvent(hEvt) instead.

in the threadloop you will do something like:
<br />
while( AtlWaitWithMessageLoop(hEvt) )<br />
{<br />
  fire_it();<br />
}<br />


this will cause that the thread will be in suspended mode, until the event is not set, or some message arrived.

This will probably introduce some major changes in your app design, but don't worry to ask/look here around. I guess it is described ot this site somewhere how to avoid such a things. Anyway, look carefuly on the event flags (CreateEvent), the bManualReset flag will be important for you to set correctly Wink | ;) probably to FALSE, depends on design... But this is out of scope of this thread OMG | :OMG:

Hope this helps
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
bahruddina7-Dec-02 21:23
bahruddina7-Dec-02 21:23 
GeneralRe: Need help in firing event from second thread using shared variable!! Pin
geo_m7-Dec-02 21:34
geo_m7-Dec-02 21:34 
Generalhandling events Pin
Dezz3-Dec-02 0:09
Dezz3-Dec-02 0:09 
GeneralATL attributed programming, need help! Pin
xi90430-Nov-02 15:56
xi90430-Nov-02 15:56 
GeneralRe: Is there an ATL equivalent for MFC's CObArray? Pin
Rene De La Garza30-Nov-02 7:52
Rene De La Garza30-Nov-02 7:52 
QuestionHow to implement a schedule in VC++ Pin
Anonymous29-Nov-02 21:45
Anonymous29-Nov-02 21:45 
AnswerRe: How to implement a schedule in VC++ Pin
Christian Graus29-Nov-02 22:15
protectorChristian Graus29-Nov-02 22:15 
AnswerRe: How to implement a schedule in VC++ Pin
geo_m4-Dec-02 3:35
geo_m4-Dec-02 3:35 
GeneralLinker error Pin
Paul Ingles28-Nov-02 10:46
Paul Ingles28-Nov-02 10:46 
GeneralRe: Linker error Pin
Rene De La Garza28-Nov-02 10:54
Rene De La Garza28-Nov-02 10:54 
GeneralRe: Linker error Pin
Paul Ingles28-Nov-02 11:21
Paul Ingles28-Nov-02 11:21 
GeneralDeallocation of Queue Memory Pin
Rizi28-Nov-02 5:33
Rizi28-Nov-02 5:33 
GeneralRe: Deallocation of Queue Memory Pin
Nick Parker28-Nov-02 6:36
protectorNick Parker28-Nov-02 6:36 
GeneralRe: XML and ATL Pin
Christian Graus27-Nov-02 10:16
protectorChristian Graus27-Nov-02 10:16 

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.