Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Threading
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 ...so could someone please help me to manage the synchronization between the threads.heres the source code http://rapidshare.com/files/406340281/SerialPortTest.rar
Thanks
Sayonee
 
[edit]Don't shout - it is rude and unnecessary. Tags changed. - OriginalGriff[/edit]
Posted 11-Jul-10 4:39am
sayonee514
Edited 11-Jul-10 4:52am
v3
Comments
OriginalGriff at 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 at 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
good
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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 13 Jul 2010
Copyright © CodeProject, 1999-2014
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