[mpich-discuss] lock/unlock regions and process synchronization

Robert Kubrick robertkubrick at gmail.com
Thu Jul 10 15:03:42 CDT 2008


I need to access a one-sided window region in a master from multiple  
slave processes. Each slave needs to read the window contents, then  
update the same window area:

MPI_Win_lock(...);
MPI_Get(&idx, ...);
MPI_Win_unlock(...);

// Got idx, check value
if( idx > 10 ) {
   idx += 5;
   MPI_Win_lock(...);
   MPI_Put(&idx);
   MPI_Win_unlock(...);
}

How can I make sure another process does not access 'idx' between the  
two lock/unlock regions in the example? 




More information about the mpich-discuss mailing list