Click here to Skip to main content
16,004,944 members

Comments by tschoni (Top 13 by date)

tschoni 2-Jun-11 20:17pm View    
i think i do, no?
other stuff is happening next do this.
and every so-and-so many seconds i update the gps signal that is used by other parts of the software

oh, and the signal frequency is basically given by the gps
maybe that's why threading makes sense. thread just sits and waits until new signal arrives, interprets it and saves it to a variable accessible by other parts of the software
tschoni 1-Jun-11 4:47am View    
it's as always very clear if someone explains it properly :)
thanks a lot for all your help!!!
all questions answered, everyone happy! (everyone being me)
tschoni 1-Jun-11 3:22am View    
thanks for the elaborate reply, please note that I posted a 'answer' which is actually a reply to your comment ... just to make code more readable
tschoni 31-May-11 23:55pm View    
Regarding 2:

At first it was unclear to me what the difference between mutex'es and critical sections are.
A good discussion on the topic can be found here:
http://www.codeguru.com/forum/showthread.php?t=333192
Summarized: Use critical sections if resources are shared only within one process.

On how to use the critical secions: the simplest syntax (or the one that suits me most) I found in this example here - very straightforward
http://msdn.microsoft.com/en-us/library/ms686908%28v=vs.85%29.aspx
tschoni 31-May-11 22:25pm View    
Regarding 1:

The link provided explains the solution well. One thing that is discussed is too is because
Thread->m_bAutoDelete = FALSE;
is used the Thread handle needs to be deleted manually.
The way I use this in a class I thought the best way to do it is using new directive when creating the thread handle in the constructor and use delete directive in the deconstructor.
This however still results in a memory leak caused by the not properly deleted thread handle, why is this?

Why is it not recommended to use Sleep();? And how to easiest create a safe dummy handle?