1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/* $Id: pvmftasks.m4,v 1.4 1997/05/07 18:07:32 pvmsrc Exp $ */
#include "pvm3.h"
#include "pvm_consts.h"
#include "../src/bfunc.h"
void
FUNCTION(pvmftasks)
ARGS(`where,
ntaskp,
tidp,
ptidp,
hostp,
flagp,
STRING_ARG(a_out),
infop')
int *where, *ntaskp, *tidp, *ptidp, *hostp, *flagp, *infop;
STRING_ARG_DECL(a_out);
{
static struct pvmtaskinfo *tip = 0;
static int ntask = 0;
static int next = 0;
int nt;
int cc;
/* if user sets ntaskp to -1 then pvmftasks() will be reset */
if ( ntask && ntaskp && (*ntaskp == -1) )
ntask = 0;
if ( !ntask ) {
if ( (cc = pvm_tasks( *where, &nt, &tip )) < 0 ) {
*infop = cc;
return;
}
ntask = nt;
next = 0;
}
if ( next < ntask ) {
if ( ntaskp ) *ntaskp = ntask;
if ( tidp ) *tidp = tip[ next ].ti_tid;
if ( ptidp ) *ptidp = tip[ next ].ti_ptid;
if ( hostp ) *hostp = tip[ next ].ti_host;
if ( flagp ) *flagp = tip[ next ].ti_flag;
if ( STRING_PTR(a_out) )
ctofstr( STRING_PTR(a_out), STRING_LEN(a_out),
tip[ next ].ti_a_out );
*infop = 1;
next++;
}
/* cannot return ti_pid without changing interface */
/* users needing this will have to use C */
if ( next == ntask )
ntask = 0;
}
|