active_thread: ThreadId,
mutex: MutexId,
) -> InterpResult<'tcx> {
- if let Some(old_locked_count) = ecx.mutex_unlock(mutex, active_thread)? {
+ if let Some(old_locked_count) = ecx.mutex_unlock(mutex, active_thread) {
if old_locked_count != 1 {
throw_unsup_format!("awaiting on a lock acquired multiple times is not supported");
}
let id = mutex_get_or_create_id(this, mutex_op)?;
let active_thread = this.get_active_thread();
- if let Some(_old_locked_count) = this.mutex_unlock(id, active_thread)? {
+ if let Some(_old_locked_count) = this.mutex_unlock(id, active_thread) {
// The mutex was locked by the current thread.
Ok(0)
} else {
&mut self,
id: MutexId,
expected_owner: ThreadId,
- ) -> InterpResult<'tcx, Option<usize>> {
+ ) -> Option<usize> {
let this = self.eval_context_mut();
let mutex = &mut this.machine.threads.sync.mutexes[id];
if let Some(current_owner) = mutex.owner {
// Mutex is locked.
if current_owner != expected_owner {
// Only the owner can unlock the mutex.
- return Ok(None);
+ return None;
}
let old_lock_count = mutex.lock_count;
mutex.lock_count = old_lock_count
// to another thread.
this.mutex_dequeue_and_lock(id);
}
- Ok(Some(old_lock_count))
+ Some(old_lock_count)
} else {
// Mutex is unlocked.
- Ok(None)
+ None
}
}