colin@la.excelan.com (Colin Goldstein) (03/16/91)
The News Manager) Nntp-Posting-Host: la Organization: Novell Inc., Open Systems Div., San Jose CA. Date: Sat, 16 Mar 1991 03:02:54 GMT Hi, I would appreciate some help with the following problem. I have a multi-thread application. There are 4 threads, although only 2 are of interest here. The main thread controls network operations, and thread 2 controls the keyboard. If the user wants to terminate the connection, they hit Esc. When the keyboard thread detects the Esc key stroke, it calls DosFlagProcess and ends. This in turn unblocks the network read (EINTR) and thread 1 cleans up and does some other processing. This all works great. A problem arises however when the server application wants to end the transaction. The network read ends when the connection is closed, but how do I end the keyboard thread??? Here is the code segment I'm using: KbdThread() /* This is thread 2 */ { KBDKEYINFO keyinfo; /* structure for keystroke info. */ USHORT rc; rc = KbdCharIn(&keyinfo, IO_WAIT, 0); if (rc) { // some error; } . . . } I've tried using DosClose(0), which does unblock KbdCharIn() and returns with an error (rc = 3924). This error is undocumented and I'm not sure that the behaviour of STDIN and STDOUT will be after I've done this. I could live with this solution if I knew that this error will be consistant, and if this solution will work in the future. If anyone has any ideas please share them with me. Thanks, Colin -- /-------------------------------------------------------------------\ | The views expressed here are my own. | Norm, what are you | | They do not necessarily represent | up too??? | | the views expressed by my employer. | | | ---------------| My ideal weight if I | | colin@novell.com | Novell Inc., | were 11 feet tall. | | uunet!novell!colin | San Jose | - Cheers | \-------------------------------------------------------------------/