Use Deadlock machine stop uniformly
This commit is contained in:
parent
100141f57c
commit
e7944419d4
@ -352,9 +352,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
|
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
|
||||||
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
|
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
|
||||||
if writers != 0 {
|
if writers != 0 {
|
||||||
throw_unsup_format!(
|
throw_machine_stop!(TerminationInfo::Deadlock);
|
||||||
"Deadlock due to read-locking a pthreads read-write lock while it is already write-locked"
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
match readers.checked_add(1) {
|
match readers.checked_add(1) {
|
||||||
Some(new_readers) => {
|
Some(new_readers) => {
|
||||||
@ -390,13 +388,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
|
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
|
||||||
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
|
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
|
||||||
if readers != 0 {
|
if readers != 0 {
|
||||||
throw_unsup_format!(
|
throw_machine_stop!(TerminationInfo::Deadlock);
|
||||||
"Deadlock due to write-locking a pthreads read-write lock while it is already read-locked"
|
|
||||||
);
|
|
||||||
} else if writers != 0 {
|
} else if writers != 0 {
|
||||||
throw_unsup_format!(
|
throw_machine_stop!(TerminationInfo::Deadlock);
|
||||||
"Deadlock due to write-locking a pthreads read-write lock while it is already write-locked"
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
rwlock_set_writers(this, rwlock_op, Scalar::from_u32(1))?;
|
rwlock_set_writers(this, rwlock_op, Scalar::from_u32(1))?;
|
||||||
Ok(0)
|
Ok(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user