Consider a loop
MPI_Buffer_attach( buf, bufsize );
while (!done) {
...
MPI_Bsend( ... );
}
where the buf is large enough to hold the message in the
MPI_Bsend. This code may fail because the
{
void *buf; int bufsize;
MPI_Buffer_detach( &buf, &bufsize );
MPI_Buffer_attach( buf, bufsize );
}