1TRECV(3PVM)                     PVM Version 3.4                    TRECV(3PVM)
2
3
4

NAME

6       pvm_trecv - Receive with timeout.
7
8

SYNOPSIS

10       C    #include <sys/time.h>
11            int bufid = pvm_trecv( int tid, int msgtag, struct timeval *tmout )
12
13       Fortran   call pvmftrecv( tid, msgtag, sec, usec, bufid )
14
15

PARAMETERS

17       tid     Integer to match task identifier of sending process.
18
19       msgtag  Integer to match message tag; should be >= 0.
20
21       tmout   (or  sec and usec) Time to wait before returning without a mes‐
22               sage.
23
24       bufid   Integer returns the value of  the  new  active  receive  buffer
25               identifier.  Values less than zero indicate an error.
26
27

DESCRIPTION

29       The  routine  pvm_trecv  blocks  the process until a message with label
30       msgtag has arrived from tid.  pvm_trecv then places the  message  in  a
31       new  active  receive  buffer, also clearing the current receive buffer.
32       If no matching message  arrives  within  the  specified  waiting  time,
33       pvm_trecv returns without a message.
34
35       A  -1 in msgtag or tid matches anything.  This allows the user the fol‐
36       lowing options.  If tid = -1 then pvm_trecv will accept a message  from
37       any process which has a matching msgtag.  If msgtag = -1 then pvm_trecv
38       will accept any message that is sent from process tid.  If tid and msg‐
39       tag  are  both  -1,  then  pvm_trecv  will  accept any message from any
40       process.
41
42       In C, the tmout fields tv_sec and tv_usec specify  how  long  pvm_trecv
43       will  wait without returning a matching message.  In Fortran, two sepa‐
44       rate parameters, sec and usec are  passed.   With  both  set  to  zero,
45       pvm_trecv behaves the same as pvm_nrecv, which is to probe for messages
46       and return immediately even if none are matched.  In C, passing a  null
47       pointer  in  tmout  makes pvm_trecv act like pvm_recv, that is, it will
48       wait indefinitely.  In Fortran, setting sec to -1 has the same effect.
49
50       The PVM model guarantees the following about message order.  If task  1
51       sends  message A to task 2, then task 1 sends message B to task 2, mes‐
52       sage A will arrive at task 2 before message B.  Moreover, if both  mes‐
53       sages arrive before task 2 does a receive, then a wildcard receive will
54       always return message A.
55
56       If pvm_trecv is successful, bufid will be the new active receive buffer
57       identifier.   If  no message is received, pvm_trecv returns 0.  If some
58       error occurs then bufid will be < 0.
59
60       Once pvm_trecv returns, the data in the message can  be  unpacked  into
61       the user's memory using the unpack routines.
62
63

EXAMPLES

65       C:
66            struct timeval tmout;
67
68            tid = pvm_parent();
69            msgtag = 4 ;
70            tmout.tv_sec = 60;
71            tmout.tv_usec = 0;
72            if ((bufid = pvm_trecv( tid, msgtag, &tmout )) > 0) {
73                 pvm_upkint( tid_array, 10, 1 );
74                 pvm_upkint( problem_size, 1, 1 );
75                 pvm_upkfloat( input_array, 100, 1 );
76            }
77
78       Fortran:
79            CALL PVMFTRECV( -1, 4, 60, 0, BUFID )
80            IF (BUFID .EQ. 0) GO TO 666
81            CALL PVMFUNPACK( INTEGER4, TIDS, 25, 1, INFO )
82            CALL PVMFUNPACK( REAL8, MATRIX, 100, 100, INFO )
83       666  CONTINUE
84
85
86

ERRORS

88       These error conditions can be returned by pvm_trecv
89
90       PvmBadParam
91              giving an invalid tid value, or msgtag < -1.
92
93       PvmSysErr
94              pvmd not responding.
95

SEE ALSO

97       pvm_bufinfo(3PVM), pvm_getminfo(3PVM), pvm_nrecv(3PVM), pvm_recv(3PVM),
98       pvm_unpack(3PVM), pvm_probe(3PVM), pvm_send(3PVM), pvm_mcast(3PVM)
99
100
101
102                               8 February, 1994                    TRECV(3PVM)
Impressum