G
Guest
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?
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?