Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multithreading - How to run always and how to interrupt

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi All,
I am new to MFC and need advice on how to go about things in a multithreaded program. I am coding a multithreaded communications application. I have a pseudo-driver class derived from CWinThread which maintains a list of message structures to write to the socket. The main thread (application) spawns this thread at initialization time and sends it a message structure (using PostThreadMessage) every time it receives one from the GUI. These messages are stored in a FIFO in the pseudo-driver class. I need to have a continuously looping function in the driver thread which pops off message structures from the FIFO, processes them and writes to the socket. I want this is go on continuously and only be interrupted when there is a message from the main thread and restart after the received message is processed.
I tried to override the Run() method but got confused in between :-(. Please give me an idea how to do it.
Thanks in advance. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top