Maybe "background loop" is the wrong term. I have a timer generating an
event every 50mS. This routine processes the data from the USB and FTP.

Graham

-----Original Message-----
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Francois PIETTE
Sent: 28 January 2011 09:42
To: ICS support mailing
Subject: Re: [twsocket] Using the FTP Client

>> While the FTP data is being processed, the USB is continually 
>> monitored and FTP processing is interrupted to service the USB.
>
> Reading that rings the bell in my head !
> If you are using polling, then this is bad design.
> Use two separate threads to handle USB and to handle FTP. Each thread 
> should work purely asynchronous (as ICS does) or work blocked on a 
> read or write (for the USB). Never use a polling loop.

> The USB is read by a high priority thread and stored in a buffer. The 
> background loop monitors the USB buffer and the buffered streams from 
> the FTP and processes accordingly.

OK, but what is the "background loop" ? If it is a pure loop checking for
boolean or integer variable flags, then it is bad design: you consume a lot
of CPU for nothing. If it is a loop using windows events (I mean
http://msdn.microsoft.com/en-us/library/ms682396(v=vs.85).aspx), semaphore
or mutex, then it is probably OK.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare The author of the
freeware Internet Component Suite (ICS) http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list please goto
http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to