osc_sm_passive_target.c: update the check for lock types
Based on some on-list and IM discussion with @hjelmn about open-mpi/ompi@40b7643119, change the testing to a switch/case. If we fall into the default case, assert() error (because it's an OMPI developer programming error).
Этот коммит содержится в:
родитель
40b7643119
Коммит
49f52a5356
@ -151,18 +151,34 @@ ompi_osc_sm_unlock(int target,
|
||||
/* ensure all memory operations have completed */
|
||||
opal_atomic_mb();
|
||||
|
||||
if (lock_none == module->outstanding_locks[target]) {
|
||||
switch (module->outstanding_locks[target]) {
|
||||
case lock_none:
|
||||
return OMPI_ERR_RMA_SYNC;
|
||||
}
|
||||
|
||||
if (module->outstanding_locks[target] == lock_nocheck) {
|
||||
case lock_nocheck:
|
||||
ret = OMPI_SUCCESS;
|
||||
} else if (module->outstanding_locks[target] == lock_exclusive) {
|
||||
break;
|
||||
|
||||
case lock_exclusive:
|
||||
ret = end_exclusive(module, target);
|
||||
} else if (module->outstanding_locks[target] == lock_shared) {
|
||||
break;
|
||||
|
||||
case lock_shared:
|
||||
ret = end_shared(module, target);
|
||||
} else {
|
||||
ret = OMPI_SUCCESS;
|
||||
break;
|
||||
|
||||
default:
|
||||
// This is an OMPI programming error -- cause some pain.
|
||||
assert(module->outstanding_locks[target] == lock_none ||
|
||||
module->outstanding_locks[target] == lock_nocheck ||
|
||||
module->outstanding_locks[target] == lock_exclusive ||
|
||||
module->outstanding_locks[target] == lock_shared);
|
||||
|
||||
// In non-developer builds, assert() will be a no-op, so
|
||||
// ensure the error gets reported
|
||||
opal_output(0, "Unknown lock type in ompi_osc_sm_unlock -- this is an OMPI programming error");
|
||||
ret = OMPI_ERR_BAD_PARAM;
|
||||
break;
|
||||
}
|
||||
|
||||
module->outstanding_locks[target] = lock_none;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user