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]
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]