Newsgroups: comp.parallel.pvm
Path: ukc!uknet!pipex!howland.reston.ans.net!EU.net!Germany.EU.net!netmbx.de!zib-berlin.de!math.fu-berlin.de!wolff
From: wolff@inf.fu-berlin.de (Thomas Wolff)
Subject: Re: How to start pvm inside a program?
Message-ID: <WSPMB12K@math.fu-berlin.de>
Sender: news@math.fu-berlin.de (Math Department)
Nntp-Posting-Host: umlaut.inf.fu-berlin.de
Organization: Free University of Berlin, Germany
References: <2k32v1$ggq@bright.ecs.soton.ac.uk> <esanchez.761865587@academ06> <2kbd6h$emi@vixen.cso.uiuc.edu> <1994Feb24.232333.290@dagoba.escape.de> <2ll3ek$hmo@quabbin.crl.dec.com>
Date: Wed, 9 Mar 1994 21:31:41 GMT
Lines: 27

hsu@crl.dec.com (William Hsu) writes:

: int
: check_and_start_pvm ()
: {
:    int  mytid;

:    if ( (mytid = pvm_mytid ()) > 0 ) return mytid;

:    /* PVM not running, start it and return */
:    printf ( "starting PVM, please be patient." );
:    system ("pvmd3 &");
:    sleep (2);    /* need to wait a little since deamon in background */
:    mytid = pvm_mytid ();
:    if ( master_tid < 0 ) master_tid = mytid;
:    return mytid;
: }
: You have to wait a little, though, since system returns right away, otherwise
: the pvm_mytid call fails.
So what about:
        mytid = pvm_mytid ();
        if (mytid == PvmSysErr) {
                system ("pvm < /dev/null");
                mytid = pvm_mytid ();
        }
        return mytid;


