Newsgroups: comp.parallel.pvm
From: manchek@thud.CS.UTK.EDU (Bob Manchek)
Subject: Re: Resetting receive buffers?
Organization: Computer Science Dept, University of Tennessee, Knoxville
Date: 13 Jun 1995 14:17:26 GMT
Message-ID: <3rk6lmINNrts@CS.UTK.EDU>

In article <1995Jun7.141023.28267@sei.cmu.edu>, nrr@sei.cmu.edu (Neal Reizer) writes:
|> ...
|> 	I have a problem in which I would like to non-destructively unpack a
|> PVM receive buffer.  The application contains an event handler that invokes
|> (one or more) callback functions in response to receiving a PVM message.
|> However, the callback functions are responsible for unpacking the PVM receive
|> buffer.  Consequently, the current implementation may only use one callback.
|> We would like to map multiple callbacks to a single PVM message.
|> 
|> 	Is there a way to unpack a PVM receive buffer non-destructively?
|> Please note that making the event handler perform the unpack and invoke the
|> callbacks with the appropriate parameters is not an acceptable solution for
|> this application.
|> 
|> 	Many thanks,
|> 
|> 
|> 
|> Neal Reizer				nrr@sei.cmu.edu
|> Software Engineering Institute		(412) 268-2854

If you are willing to trick the PVM code, you can rewind a message.
Setting it as the current packable message, and then back, will
reset the read pointer.

    m = pvm_setsbuf(pvm_getrbuf());
    pvm_setrbuf(pvm_setsbuf(m));
    /* rbuf now rewound */

(The purpose of m is just to save the current send buffer, if one
exists)

But, this is a dirty trick.  It should work in any of the unix ports,
but I'm not sure about the others.  And it's not a real feature, so
it could conceivably go away.

We've been asked for a rewind before, but I've held out because it
breaks optimizations one might want to do, like transferring the
message data during unpack instead of receive, and discarding it
as you go to save space.

-b
-- 
/ Robert Manchek                University of Tennessee     /
/                               Computer Science Department /
/ (615)974-8295                 Ayres Hall #104             /
/ manchek@CS.UTK.EDU.           Knoxville TN  37996-1301    /
/     http://www.netlib.org/utk/people/BobManchek.html      /


