]> git.lizzy.rs Git - rust.git/commitdiff
Use Deadlock machine stop uniformly
authorDavid Cook <divergentdave@gmail.com>
Sun, 5 Apr 2020 17:44:23 +0000 (12:44 -0500)
committerDavid Cook <divergentdave@gmail.com>
Sun, 5 Apr 2020 17:44:23 +0000 (12:44 -0500)
src/shims/sync.rs

index c9d846288a43e2147ccfd39dc3f6f1919444ae9c..90d7104b9e7b0671c1a09f11cc14acc8a78fb4b0 100644 (file)
@@ -352,9 +352,7 @@ fn pthread_rwlock_rdlock(&mut self, rwlock_op: OpTy<'tcx, Tag>) -> InterpResult<
         let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
         let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
         if writers != 0 {
-            throw_unsup_format!(
-                "Deadlock due to read-locking a pthreads read-write lock while it is already write-locked"
-            );
+            throw_machine_stop!(TerminationInfo::Deadlock);
         } else {
             match readers.checked_add(1) {
                 Some(new_readers) => {
@@ -390,13 +388,9 @@ fn pthread_rwlock_wrlock(&mut self, rwlock_op: OpTy<'tcx, Tag>) -> InterpResult<
         let readers = rwlock_get_readers(this, rwlock_op)?.to_u32()?;
         let writers = rwlock_get_writers(this, rwlock_op)?.to_u32()?;
         if readers != 0 {
-            throw_unsup_format!(
-                "Deadlock due to write-locking a pthreads read-write lock while it is already read-locked"
-            );
+            throw_machine_stop!(TerminationInfo::Deadlock);
         } else if writers != 0 {
-            throw_unsup_format!(
-                "Deadlock due to write-locking a pthreads read-write lock while it is already write-locked"
-            );
+            throw_machine_stop!(TerminationInfo::Deadlock);
         } else {
             rwlock_set_writers(this, rwlock_op, Scalar::from_u32(1))?;
             Ok(0)