+ target_win->mode_+= lock_type;//add the lock_type to differentiate case when we are switching from EXCLUSIVE to SHARED (no release needed in the unlock)
+ if(lock_type == MPI_LOCK_SHARED){//the window used to be exclusive, it's now shared.
+ xbt_mutex_release(target_win->lock_mut_);
+ }
+ } else if(!(target_win->mode_==MPI_LOCK_SHARED && lock_type == MPI_LOCK_EXCLUSIVE))
+ target_win->mode_+= lock_type; // don't set to exclusive if it's already shared