Click here to Skip to main content
15,890,982 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamic Menu Creation Pin
_Flaviu25-Feb-15 0:45
_Flaviu25-Feb-15 0:45 
GeneralRe: Dynamic Menu Creation Pin
Thakur JAI SINGH25-Feb-15 2:09
Thakur JAI SINGH25-Feb-15 2:09 
GeneralRe: Dynamic Menu Creation Pin
Frankie-C25-Feb-15 3:06
Frankie-C25-Feb-15 3:06 
QuestionRe: Dynamic Menu Creation Pin
David Crow25-Feb-15 5:53
David Crow25-Feb-15 5:53 
QuestionSetEvent and WaitForSiongleObject Pin
Munchies_Matt23-Feb-15 6:02
Munchies_Matt23-Feb-15 6:02 
AnswerRe: SetEvent and WaitForSiongleObject Pin
Albert Holguin23-Feb-15 9:45
professionalAlbert Holguin23-Feb-15 9:45 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt23-Feb-15 21:26
Munchies_Matt23-Feb-15 21:26 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Jochen Arndt23-Feb-15 23:10
professionalJochen Arndt23-Feb-15 23:10 
It looks like a design error. You use a blocking ReadFile call. It would be better to use overlapping reads or wait for data available. Overall I would use only one thread (which should be a worker thread):
Thread loop:
 Write data to trigger receiption
 Read data overlapped 
 When ReadFile returns ERROR_IO_PENDING
  Wait for completion
 Process data
 Write ACK
 Optional short wait time (may also check for a thread kill event)

To report errors occuring in the worker thread you can send user defined messages to your main (GUI) thread.

Similar when data processing requires some GUI output or is performed by another thread (then set an event when processing is finished and wait for it at the end of the communication thread).
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 0:02
Munchies_Matt24-Feb-15 0:02 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Albert Holguin24-Feb-15 3:54
professionalAlbert Holguin24-Feb-15 3:54 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 4:02
Munchies_Matt24-Feb-15 4:02 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Albert Holguin24-Feb-15 4:06
professionalAlbert Holguin24-Feb-15 4:06 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 4:13
Munchies_Matt24-Feb-15 4:13 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Albert Holguin24-Feb-15 4:16
professionalAlbert Holguin24-Feb-15 4:16 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 5:13
Munchies_Matt24-Feb-15 5:13 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt23-Feb-15 22:25
Munchies_Matt23-Feb-15 22:25 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Albert Holguin24-Feb-15 4:00
professionalAlbert Holguin24-Feb-15 4:00 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 4:12
Munchies_Matt24-Feb-15 4:12 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Frankie-C24-Feb-15 5:19
Frankie-C24-Feb-15 5:19 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 6:46
Munchies_Matt24-Feb-15 6:46 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Frankie-C24-Feb-15 21:46
Frankie-C24-Feb-15 21:46 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 22:12
Munchies_Matt24-Feb-15 22:12 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Frankie-C24-Feb-15 22:49
Frankie-C24-Feb-15 22:49 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Munchies_Matt24-Feb-15 22:57
Munchies_Matt24-Feb-15 22:57 
GeneralRe: SetEvent and WaitForSiongleObject Pin
Frankie-C24-Feb-15 23:02
Frankie-C24-Feb-15 23:02 

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.