Subj : Threading and Timeouts To : comp.programming.threads From : MC Date : Mon Jul 18 2005 11:03 pm Hi all, Please let me know if there's a more appropriate group for my question--perhaps a Windows group. I suspect it's more of a general threading Q though... First off, I'm in the WinAPI environment and I'm finding that asynchronous API calls for connecting to an FTP server are very tedious. I'd prefer not to deal with all the states and handles if possible--hence the idea of using synchronous API calls in a separate thread. Here's the question: if the main thread creates a worker thread and the worker makes a synchronous call--say to connect to the FTP server--what's the best way to implement a timeout on that call? What I've thought of so far is: main thread starts a timer main thread starts worker thread if timer ticks before worker is complete then terminate worker thread However, according to MSDN, terminating a thread should only be used as a last resort because it doesn't do proper cleanup. But then how else can a timeout be implemented, given that the worker thread is busy in a synchronous API call? Am I doing this all wrong?? Thanks for any help! Craig .