16,016,527 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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?
tschoni
31-May-11 8:48am
View
Deleted
thanks for taking the time to look at my code and for the good answers.
i will try to implement tomorrow and post anything I stumble accross here, in case anybody else will try to do something similar in the future.
tschoni
31-May-11 2:14am
View
NOTE: the title of this thread is misleading by now, I started another thread under
http://www.codeproject.com/Questions/204050/Thread-communication-thread-safety-example-problem.aspx
to any moderator, I think this thread should be deleted, content & title dont really match anymore and example problem is misleading
many thanks for your help
tschoni
31-May-11 1:42am
View
thanks for the suggestions
however, i feel the "easy" way to do is is still using a working thread, I dont see why a UI thread should be used, can you maybe explain?
because the "main" purpose is not really sending messages back and forth but just "publishing" received data in a fixed time interval.
the only message it has to somehow receive is when to terminate (which will be only when starting & shutting down pc)
tschoni
26-May-11 0:07am
View
Of course the INFINITE timeout is just here because this is meant as an example.
About the better ways to solve this:
The idea is to write a class which handles reading GPS data from a serial bus.
The whole idea behind encapsulating this in a class was thread safety to begin with.
One thread as part of the class should be reading data.
The data should only be accessible through a class member function, which implicitly ensures thread safety without the caller having to worry about it.
I see that the "friend" solution is kind of drifting apart from this.
Maybe I should use a static member function, that receives a "this" pointer as argument, instead of a friend function.
Maybe you suggest something else?
tschoni
20-May-11 23:32pm
View
thanks for the good suggestion
this looks exactly like what i need, will test it this afternoon and post whether it did what i wanted :)
tschoni
20-May-11 5:16am
View
thanks for the tipp, might be safer, but by itself it didn't solve the problem
tschoni
18-May-11 4:08am
View
good to know, in the example code I actually wondered what the m_ convention means. thanks a lot.
tschoni
18-May-11 3:41am
View
perfect answer, thanks a million times
Show More