RECVF(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

πŸŽ€ RECVF β€” bestie edition πŸŽ€

okay so this is pvm_recvf, from the PVM Version 3.4 manual, section 3PVM. it lives in the C world only, and it's about ✨customizing how PVM decides which message you're actually receiving✨. no cap, it's a whole vibe.


πŸ’– NAME πŸ’–

pvm_recvf β€” redefines the comparison function used to accept messages. that's it, that's the girl. πŸ’…


✨ SYNOPSIS ✨

C only, bestie:

int (*old)() = pvm_recvf( int (*new)( int bufid, int tid, int tag ))

Fortran: NOT AVAILABLE 🚫 β€” nope, not today, not ever, sorry to the Fortran girlies.


πŸ¦‹ DESCRIPTION πŸ¦‹

so pvm_recvf defines the comparison function that pvm_recv, pvm_nrecv, and pvm_probe are gonna use. it exists as a way to customize PVM message passing β€” like, make it yours. pvm_recvf sets a user-supplied comparison function to evaluate messages for receiving.

recvf returns the old value of the matching function, or 0 if the old function was the default matcher. so you can swap it out and swap it back, iykyk. πŸ’–

real talk tho: pvm_recvf is intended for sophisticated C programmers who understand the function of such routines (like signal) and who require a receive routine that can match on more complex message contexts than the default provides. it's giving advanced. it's giving main character energy. don't come in here unprepared. 😭

🌸 MATCHING FUNCTION 🌸

the default comparison function evaluates the source and message tag associated with all incoming messages.


πŸ’œ PARAMETERS πŸ’œ

  • tid β€” Integer task identifier of sending process supplied by the user.
  • tag β€” Integer message tag supplied by the user.
  • bufid β€” Integer message buffer identifier.

and the matching function should return:

  • < 0 β€” Return immediately with this error code. πŸƒβ€β™€οΈ
  • 0 β€” Do not pick this message. πŸ™ˆ
  • 1 β€” Pick this message and do not scan the rest. πŸ‘‘
  • > 1 β€” Pick this highest ranked message after scanning them all. ⭐

like, that's the whole scoring system. it's basically a vibe check for messages.


🌈 EXAMPLES 🌈

Implementing message probe with recvf, using our matching function to return information in a global variable. iconic behavior honestly.

#include <pvm3.h>

static int foundit = 0;

static int
foo_match(mid, tid, tag)
     int mid;
     int tid;
     int tag;
{
     int t, c;
     struct pvmminfo header;

     pvm_getminfo(mid, &header);

     if ((tid == -1 || tid == header.src) && (tag == -1 || tag == header.tag))
          foundit = 1;

     return 0;
}

int
probe(src, tag)
{
     int (*omatch)();
     int cc;

     omatch = pvm_recvf(foo_match);

     foundit = 0;

     if ((cc = pvm_nrecv(src, tag)) < 0)
          return cc;

     pvm_recvf(omatch);

     return foundit;
}

πŸ’€ ERRORS πŸ’€

No error conditions are returned by pvm_recvf. not a single one. she's unproblematic fr fr. 🫢


πŸ“ SEE ALSO πŸ“

  • pvm_bufinfo(3PVM)
  • pvm_getminfo(3PVM)
  • pvm_recv(3PVM)
  • pvm_nrecv(3PVM)
  • pvm_probe(3PVM)
  • pvm_trecv(3PVM)

and that's the whole page, bestie!! 🌈✨

this was PVM Version 3.4, and the page is dated 30 August, 1993 β€” yeah she's a vintage queen and she still slays. πŸŽ€ go match some messages. πŸ’…πŸ’–

πŸ“¦ where this page comes from