starting multiple processes

J

Junkone

hello
i have to do the following
1. exec("E:\\TradingTools\\IBController\
\IBControllerStart_customised.bat")
2. application = WIN32OLE.new("Broker.Application")

I want to start 1 and then continue doing 2. however when i run it
realtime, the statement 2 waits for statement 1 to be completed which
takes long time. how do i initiate 1 and then withotu waiting goto
statement 2.

apreciate ur help

seede
 
J

Joel VanderWerf

Junkone said:
hello
i have to do the following
1. exec("E:\\TradingTools\\IBController\
\IBControllerStart_customised.bat")
2. application = WIN32OLE.new("Broker.Application")

I want to start 1 and then continue doing 2. however when i run it
realtime, the statement 2 waits for statement 1 to be completed which
takes long time. how do i initiate 1 and then withotu waiting goto
statement 2.

Wrap #1 in a thread:

Thread.new do
exec(...)
end
 
R

Robert Klemme

2007/12/20 said:
Wrap #1 in a thread:

Thread.new do
exec(...)
end

Wouldn't help. This is #exec and not #system - the process does not
wait, it is completely replaced and "application =
WIN32OLE.new("Broker.Application")" is never executed.

You rather want fork.

fork do
exec ...
end

Cheers

robert
 
G

Gordon Thiesfeld

Wouldn't help. This is #exec and not #system - the process does not
wait, it is completely replaced and "application =
WIN32OLE.new("Broker.Application")" is never executed.

You rather want fork.

fork do
exec ...
end

Cheers

robert


Fork isn't implemented on Windows. Try this:

system("start E:\\TradingTools\\IBController\\IBControllerStart_customised.bat")
application = WIN32OLE.new("Broker.Application")

-Gordon
 
R

Robert Klemme

2007/12/20 said:
Fork isn't implemented on Windows.

Unless you are using cygwin. Sorry, I keep forgetting that the other
Windows based versions do not have it. Thanks for correcting me!
Try this:

system("start E:\\TradingTools\\IBController\\IBControllerStart_customised.bat")
application = WIN32OLE.new("Broker.Application")

Kind regards

robert
 
J

Joel VanderWerf

Robert said:
Wouldn't help. This is #exec and not #system - the process does not
wait, it is completely replaced and "application =
WIN32OLE.new("Broker.Application")" is never executed.

Oops, you're quite right, I was thinking of #system.

Maybe #system would be right for the OP:

Thread.new do
system("...")
end

application = ..

This is AFAIK platform independent, since it doesn't (explicitly,
anyway) use #fork or "start".
 
J

Junkone

Oops, you're quite right, I was thinking of #system.

Maybe #system would be right for the OP:

   Thread.new do
     system("...")
   end

   application = ..

This is AFAIK platform independent, since it doesn't (explicitly,
anyway) use #fork or "start".

i tried that. it does not work for me. it waits
Thread.new do
system("start E:\\TradingTools\\IBController\
\IBControllerStart_customised.bat")
end
to get completed before going and doing this
application = WIN32OLE.new("Broker.Application")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top