Multithreadind and Remote Shell (RSH)
From: Vicent Soler (VicentSoler_at_discussions.microsoft.com)
Date: 02/10/05
- Next message: Larry Brasfield: "Re: ... Why my Release exe needs mfc80.dll ?"
- Previous message: Tom Widmer: "Re: Why no C++ in Windows itself?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Feb 2005 10:25:04 -0800
Hi all,
I'll try to explain my problem:
- The tool which I'm developing launches hundreds of RSH commands from
differents threads to a remote UNIX machine.
- Sometimes, this UNIX machines lasts to much to answer the RSH command sent
from the tool and then the RSH command (MS-DOS window) is blocked in the PC
until the remote machine answers.
- I have a call to the WaitForSingleObject method to set a timeout for the
RSH command and avoid waiting an infinite time to the RSH response.
- In fact, when one RSH command times out, I associate a Job object
(CreateJobObject, AssociateJobObject) to the RSH process, and I kill it. In
that case, the RSH command disappear from the Windows' Task Manager and seems
to have been correctly removed.
- Until now, the tool don't have internally a list of launched threads (RSH
commands) because they terminate automatically when receives the response
from the UNIX machine.
- The problem begins when one of the thread (RSH Command) is blocked in
waiting for the response from the remote machine and the user leaves the
tool. In this case, sometimes in the Windows' Task Manager remain lots of RSH
processes running because the UNIX machine don't answer.
My question is, what can I do to terminate all this RSH processes before
leaving the tool?? Should the OS terminate it when terminating the main
process (tool)?
I have read in the MSDN that terminating a thread prematuraly can cause some
problems in the OS (in fact, I always use the Job terminating method). Can I
have a list of Jobs objects (created RSH commands) and when the users leave
the tool terminate all remaining RSH processes?? What happens if I terminate
an object which has already terminated?
Thanks in advance...
Vicent
- Next message: Larry Brasfield: "Re: ... Why my Release exe needs mfc80.dll ?"
- Previous message: Tom Widmer: "Re: Why no C++ in Windows itself?"
- Messages sorted by: [ date ] [ thread ]