process fire and forget?

Discussion in 'Ruby' started by Michael Ulm, Nov 29, 2004.

  1. Michael Ulm

    Michael Ulm Guest

    Is there a ruby way of firing up a process and then
    forget about it?

    I have a program that processes some data, and sometimes
    forks off a process that creates a file from part of the
    data. I want then to automatically open a text editor on
    that file. Rubys involvement with the file stops there.
    However, making just a system call to start the editor
    lets the thread hang around until the user closes the
    editor. This seems a bit of a waste of resources.

    I need a platform independent solution btw, since this
    should run (at least) on three different hardware/OS
    combinations.

    Thanks,

    Michael

    --
    Michael Ulm
    R&D Team
    ISIS Information Systems Austria
    tel: +43 2236 27551-219, fax: +43 2236 21081
    e-mail:
    Visit our Website: www.isis-papyrus.com
     
    Michael Ulm, Nov 29, 2004
    #1
    1. Advertising

  2. Hi,

    In message "Re: process fire and forget?"
    on Mon, 29 Nov 2004 18:14:30 +0900, Michael Ulm <> writes:

    |Is there a ruby way of firing up a process and then
    |forget about it?

    --------------------------------------------------------- Process#detach
    Process.detach(pid) => thread
    ------------------------------------------------------------------------
    Some operating systems retain the status of terminated child
    processes until the parent collects that status (normally using
    some variant of +wait()+. If the parent never collects this status,
    the child stays around as a _zombie_ process. +Process::detach+
    prevents this by setting up a separate Ruby thread whose sole job
    is to reap the status of the process _pid_ when it terminates. Use
    +detach+ only when you do not intent to explicitly wait for the
    child to terminate. +detach+ only checks the status periodically
    (currently once each second).
     
    Yukihiro Matsumoto, Nov 29, 2004
    #2
    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. Stephen Barrett

    Asynchronous Fire-And-Forget Call

    Stephen Barrett, Apr 11, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    1,019
    Stephen Barrett
    Apr 13, 2006
  2. Ames Andreas (MPA/DF)
    Replies:
    0
    Views:
    329
    Ames Andreas (MPA/DF)
    Aug 5, 2004
  3. Braulio Diez
    Replies:
    4
    Views:
    635
    Braulio Diez
    Feb 9, 2008
  4. U.Mutlu

    freeze and forget it :-)

    U.Mutlu, Feb 12, 2012, in forum: C++
    Replies:
    4
    Views:
    303
    Jorgen Grahn
    Feb 12, 2012
  5. Dave Saville

    Fire and forget under OS/2

    Dave Saville, Oct 3, 2012, in forum: Perl Misc
    Replies:
    2
    Views:
    356
    Dave Saville
    Oct 4, 2012
Loading...

Share This Page