foc: use Mutex

Issue #3809
This commit is contained in:
Alexander Boettcher 2020-07-07 13:49:01 +02:00 committed by Norman Feske
parent 6fa4307005
commit 997a77b3de
4 changed files with 10 additions and 10 deletions

View File

@ -17,7 +17,6 @@
#define _INCLUDE__FOC__THREAD_STATE_H_
#include <base/capability.h>
#include <base/lock.h>
#include <base/thread_state.h>
/* Fiasco includes */

View File

@ -14,13 +14,14 @@
#ifndef _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
#define _CORE__INCLUDE__PAGER_OBJECT_EXCEPTION_STATE_H_
#include <base/mutex.h>
#include <foc/thread_state.h>
namespace Genode { struct Pager_object_exception_state; }
struct Genode::Pager_object_exception_state
{
Lock lock { };
Mutex mutex { };
unsigned exceptions; /* counts exceptions raised by the thread */
bool paused; /* indicates whether thread is stopped */
bool in_exception; /* true if thread is in exception */

View File

@ -57,7 +57,7 @@ void Pager_entrypoint::entry()
case Ipc_pager::EXCEPTION:
{
if (_pager.exception()) {
Lock::Guard guard(obj->state.lock);
Mutex::Guard guard(obj->state.mutex);
_pager.get_regs(obj->state.state);
obj->state.exceptions++;
obj->state.in_exception = true;
@ -94,7 +94,7 @@ void Pager_entrypoint::entry()
_pager.acknowledge_wakeup();
{
Lock::Guard guard(obj->state.lock);
Mutex::Guard guard(obj->state.mutex);
/* revert exception flag */
obj->state.in_exception = false;
/* set new register contents */
@ -113,7 +113,7 @@ void Pager_entrypoint::entry()
*/
case Ipc_pager::PAUSE:
{
Lock::Guard guard(obj->state.lock);
Mutex::Guard guard(obj->state.mutex);
_pager.get_regs(obj->state.state);
obj->state.exceptions++;
obj->state.in_exception = true;

View File

@ -89,10 +89,10 @@ void Platform_thread::pause()
if (!_pager_obj)
return;
_pager_obj->state.lock.lock();
_pager_obj->state.mutex.acquire();
if (_pager_obj->state.paused == true) {
_pager_obj->state.lock.unlock();
_pager_obj->state.mutex.release();
return;
}
@ -118,7 +118,7 @@ void Platform_thread::pause()
* The thread state ("ready") is encoded in the lowest bit of the flags.
*/
bool in_syscall = (flags & 1) == 0;
_pager_obj->state.lock.unlock();
_pager_obj->state.mutex.release();
/**
* Check whether the thread was in ongoing ipc, if so it won't raise
@ -151,11 +151,11 @@ void Platform_thread::resume()
if (!_pager_obj)
return;
_pager_obj->state.lock.lock();
_pager_obj->state.mutex.acquire();
/* Mark thread to be runable again */
_pager_obj->state.paused = false;
_pager_obj->state.lock.unlock();
_pager_obj->state.mutex.release();
/* Send a message to the exception handler, to unblock the client */
Msgbuf<16> snd, rcv;