Ok, I'm trying to learn how to use threading, but I've run into a problem.
I'm doing this in VB.Net. I started out making something pretty simple.
Just a sort of wrapper for cmd.exe. I used separate threads to read from
stdin and stderr. It seemed to be working ok. Then I added macros to it.
Here's what's happening. The sub that runs the commands gets called several
times in a row very quickly. It's spawns a new cmd.exe process each time,
and a couple of threads to listen for the output. The problem is that the
commands can take different amounts of time to finish, so the output I get is
all out of order. I need to make sure that the commands run one at a time,
each one waiting until the previous one is done. How exactly can I do that?

RE: Threading question by Bagger

Bagger
Wed Jul 20 15:55:04 CDT 2005

I meant to say that I'm using separate threads to read from stdout and
stderr. I'm not doing anything with stdin right now. If anyone can help me
with this, it would be much appreciated. Thanks.

"Bagger" wrote:

> Ok, I'm trying to learn how to use threading, but I've run into a problem.
> I'm doing this in VB.Net. I started out making something pretty simple.
> Just a sort of wrapper for cmd.exe. I used separate threads to read from
> stdin and stderr. It seemed to be working ok. Then I added macros to it.
> Here's what's happening. The sub that runs the commands gets called several
> times in a row very quickly. It's spawns a new cmd.exe process each time,
> and a couple of threads to listen for the output. The problem is that the
> commands can take different amounts of time to finish, so the output I get is
> all out of order. I need to make sure that the commands run one at a time,
> each one waiting until the previous one is done. How exactly can I do that?

Re: Threading question by Alvin

Alvin
Wed Jul 20 18:03:30 CDT 2005

post some code. i think you chose a difficult example. i think, not to sure
if old age is betraying me, that stdin/out/err are affined. That won't
affect the read order but it may cause some exceptions. if you are trying a
threaded app, how about a simple hello world application

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Bagger" <Bagger@discussions.microsoft.com> wrote in message
news:2C5D63B6-F9FB-4E9D-9A7E-71002C0E2D43@microsoft.com...
>I meant to say that I'm using separate threads to read from stdout and
> stderr. I'm not doing anything with stdin right now. If anyone can help
> me
> with this, it would be much appreciated. Thanks.
>
> "Bagger" wrote:
>
>> Ok, I'm trying to learn how to use threading, but I've run into a
>> problem.
>> I'm doing this in VB.Net. I started out making something pretty simple.
>> Just a sort of wrapper for cmd.exe. I used separate threads to read from
>> stdin and stderr. It seemed to be working ok. Then I added macros to
>> it.
>> Here's what's happening. The sub that runs the commands gets called
>> several
>> times in a row very quickly. It's spawns a new cmd.exe process each
>> time,
>> and a couple of threads to listen for the output. The problem is that
>> the
>> commands can take different amounts of time to finish, so the output I
>> get is
>> all out of order. I need to make sure that the commands run one at a
>> time,
>> each one waiting until the previous one is done. How exactly can I do
>> that?