starting multiple processes

Discussion in 'Ruby' started by Junkone, Dec 19, 2007.

  1. Junkone

    Junkone Guest

    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
     
    Junkone, Dec 19, 2007
    #1
    1. Advertising

  2. Junkone wrote:
    > 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

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
     
    Joel VanderWerf, Dec 19, 2007
    #2
    1. Advertising

  3. 2007/12/20, Joel VanderWerf <>:
    > Junkone wrote:
    > > 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


    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

    --
    use.inject do |as, often| as.you_can - without end
     
    Robert Klemme, Dec 20, 2007
    #3
  4. On Dec 20, 2007 2:34 AM, Robert Klemme <> wrote:
    > 2007/12/20, Joel VanderWerf <>:
    > > Junkone wrote:
    > > > 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

    >
    > 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
    >
    > --
    > use.inject do |as, often| as.you_can - without end
    >



    Fork isn't implemented on Windows. Try this:

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

    -Gordon
     
    Gordon Thiesfeld, Dec 20, 2007
    #4
  5. 2007/12/20, Gordon Thiesfeld <>:
    > On Dec 20, 2007 2:34 AM, Robert Klemme <> wrote:
    > > 2007/12/20, Joel VanderWerf <>:
    > > > Junkone wrote:
    > > > > 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

    > >
    > > 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
    > >
    > > --
    > > use.inject do |as, often| as.you_can - without end
    > >

    >
    >
    > 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

    --
    use.inject do |as, often| as.you_can - without end
     
    Robert Klemme, Dec 20, 2007
    #5
  6. Robert Klemme wrote:
    > 2007/12/20, Joel VanderWerf <>:
    >> Junkone wrote:
    >>> 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

    >
    > 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".

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
     
    Joel VanderWerf, Dec 21, 2007
    #6
  7. Junkone

    Junkone Guest

    On Dec 21, 2:55 pm, Joel VanderWerf <> wrote:
    > Robert Klemme wrote:
    > > 2007/12/20, Joel VanderWerf <>:
    > >> Junkone wrote:
    > >>> 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

    >
    > > 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".
    >
    > --
    >        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407-Hide quoted text -
    >
    > - Show quoted text -


    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")
     
    Junkone, Dec 22, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SW5kZXB0aA==?=
    Replies:
    1
    Views:
    479
    Bruce Barker
    Apr 1, 2005
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,140
    David Schwartz
    Dec 9, 2003
  3. Smegly
    Replies:
    1
    Views:
    1,109
    Mitchell
    May 19, 2004
  4. benny
    Replies:
    6
    Views:
    173
    Dick Davies
    Apr 25, 2005
  5. Marc Heiler
    Replies:
    1
    Views:
    179
    Robert Klemme
    May 24, 2009
Loading...

Share This Page