There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
adware audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware mouse msn network networking outlook 2007 popups power printer problem ram router screen slow sound trojan usb virtumonde virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
MultiThreading in MFC for modem drivers


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Timoteusz's Avatar
Junior Member with 2 posts.
 
Join Date: Mar 2005
Location: Ontario
Experience: Advanced
28-Mar-2005, 08:31 PM #1
MultiThreading in MFC for modem drivers
I've run into a slight issue while trying to design Modem drivers (1200 baud) to be exact.

Although we have spent a fair amount of hours in the environment, we havent been introduced to threading. I understand the concept and the hooks around launching threads, I've just never actualy gotten one working properly.

My situation is as follows, using a single path application with multiple timers just wont cut it for these modems. The shortest timer is 1 ms and those little modems chunck out characters MUCH faster than that. The issue become that the software is almost unable to catch all the incoming characters, and formating packets with STX, ETX checksums and other control characters become a hastle because we are never guarenteed that the full packet was received properly. The modem keeps missing either a piece of data or one of the control chars and almost always locks the transmission until they can finaly resync. (Yes there is error checking and retransmission on an ACK/NACK system.)

#1 I Am wondering if it is prudent/possible to launch a thread on init or in a constructor that can query the UART to check if a character has come in, and if so, GRAB it right away so that the next incoming character doesnt clobber the previous one.

#2 How do I go about this? The MSDN site is very vague and has me running in circles.

So far I know that I need to create a control function to be launched ex UINT MyThread( LPVOID lparam), and launch that as a worker thread in the background AfxBeginThread(MyThread, this->hWnd,??) <--- the rest becomes quite confusing.

Im assuming somewhere in there I have to throw in a custom message ex: WM_USER + 1 type of defenition as to catch messages from that thread?

Any further than that and I'm wandering in the dark.

Any help/suggestions would be much appreciated.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:43 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.