Skip to content

Commit e794441

Browse files
committed
Use Deadlock machine stop uniformly
1 parent 100141f commit e794441

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/shims/sync.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
352352
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
353353
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
354354
if writers != 0 {
355-
throw_unsup_format!(
356-
"Deadlock due to read-locking a pthreads read-write lock while it is already write-locked"
357-
);
355+
throw_machine_stop!(TerminationInfo::Deadlock);
358356
} else {
359357
match readers.checked_add(1) {
360358
Some(new_readers) => {
@@ -390,13 +388,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
390388
let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
391389
let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
392390
if readers != 0 {
393-
throw_unsup_format!(
394-
"Deadlock due to write-locking a pthreads read-write lock while it is already read-locked"
395-
);
391+
throw_machine_stop!(TerminationInfo::Deadlock);
396392
} else if writers != 0 {
397-
throw_unsup_format!(
398-
"Deadlock due to write-locking a pthreads read-write lock while it is already write-locked"
399-
);
393+
throw_machine_stop!(TerminationInfo::Deadlock);
400394
} else {
401395
rwlock_set_writers(this, rwlock_op, Scalar::from_u32(1))?;
402396
Ok(0)

0 commit comments

Comments
 (0)