Click here to Skip to main content
11,922,789 members (48,871 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ threads
hello there I am trying to code(VISUAL C++ 6) a simple application which would help me in reading from a serial port and write to the same serial port using a single thread could someone please help me to manage the synchronization between the threads.heres the source code

[edit]Don't shout - it is rude and unnecessary. Tags changed. - OriginalGriff[/edit]
Posted 11-Jul-10 4:39am
Edited 11-Jul-10 4:52am
OriginalGriff 11-Jul-10 9:54am
Don't shout.
It is very unlikely that your Rapidshare link will be followed: Most work filters block rapidshare, and very view of us will download an unknown RAR file anyway. Instead, post relevant code fragments in your original question, using the "code block" widget to preserve the formatting.
gleat 12-Jul-10 17:27pm
If there's only a single thread what is there to synchronize? Or do you mean a single thread in addition to the main thread? Also, as "OriginalGriff" mentioned, please post code fragments. The question is just more likely to be answered then.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you write MFC code, I think the simplest way is to use AfxBeginThread to create your work thread, if you want to both reading and writing data to a same port, you can use <pre lang="C++">CCriticalSection</pre>
, CEvent, CMutex or <pre lang="C++">CSemaphore</pre>
if you choose CEvent, you can use <pre lang="C++">WaitForSingleObject</pre>
to wait your CEvent object

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151125.1 | Last Updated 13 Jul 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100