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

NAME

6       pvm_recvf - Redefines the comparison function used to accept messages.
7
8

SYNOPSIS

10       C    int (*old)() = pvm_recvf( int (*new)( int bufid, int tid, int tag ))
11
12       Fortran   NOT AVAILABLE
13
14

DESCRIPTION

16       The routine pvm_recvf defines the comparison function to be used by the
17       pvm_recv, pvm_nrecv, and pvm_probe functions.  It  is  available  as  a
18       means to customize PVM message passing.  pvm_recvf sets a user supplied
19       comparison function to evaluate messages for receiving.
20
21       recvf returns the old value of the matching function, or 0 if  the  old
22       function was the default matcher
23
24       pvm_recvf  is  intended  for sophisticated C programmers who understand
25       the function of such routines (like signal) and who require  a  receive
26       routine  that  can  match  on  more  complex  message contexts than the
27       default provides.
28
29

MATCHING FUNCTION

31       The default comparison function evaluates the source  and  message  tag
32       associated with all incoming messages.
33
34

PARAMETERS

36       tid     Integer  task  identifier  of  sending  process supplied by the
37               user.
38
39       tag     Integer message tag supplied by the user.
40
41       bufid   Integer message buffer identifier.
42
43       The matching function should return:
44
45            Value     Action taken
46            < 0       Return immediately with this error code.
47              0       Do not pick this message.
48              1       Pick this message and do not scan the rest.
49            > 1       Pick this highest ranked message after
50                      scanning them all.
51

EXAMPLES

53       Implementing message probe with recvf, using our matching  function  to
54       return information in a global variable.
55
56       #include <pvm3.h>
57
58       static int foundit = 0;
59
60       static int
61       foo_match(mid, tid, tag)
62            int mid;
63            int tid;
64            int tag;
65       {
66            int t, c;
67            struct pvmminfo header;
68
69            pvm_getminfo(mid, &header);
70
71            if ((tid == -1 || tid == header.src) && (tag == -1 || tag == header.tag))
72                 foundit = 1;
73
74            return 0;
75       }
76
77       int
78       probe(src, tag)
79       {
80            int (*omatch)();
81            int cc;
82
83            omatch = pvm_recvf(foo_match);
84
85            foundit = 0;
86
87            if ((cc = pvm_nrecv(src, tag)) < 0)
88                 return cc;
89
90            pvm_recvf(omatch);
91
92            return foundit;
93       }
94
95

ERRORS

97       No error conditions are returned by pvm_recvf
98

SEE ALSO

100       pvm_bufinfo(3PVM), pvm_getminfo(3PVM), pvm_recv(3PVM), pvm_nrecv(3PVM),
101       pvm_probe(3PVM), pvm_trecv(3PVM)
102
103
104
105                                30 August, 1993                    RECVF(3PVM)
Impressum