2016-11-07 17:00:24 +00:00
|
|
|
/*
|
|
|
|
* \brief Lock dummy implementation
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2016-09-23
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2016-2017 Genode Labs GmbH
|
2016-11-07 17:00:24 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2016-11-07 17:00:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <base/lock.h>
|
2017-02-21 12:46:59 +00:00
|
|
|
#include <hw/assert.h>
|
2016-11-07 17:00:24 +00:00
|
|
|
|
|
|
|
Genode::Cancelable_lock::Cancelable_lock(Genode::Cancelable_lock::State state)
|
|
|
|
: _state(state), _owner(nullptr) { }
|
|
|
|
|
|
|
|
|
|
|
|
void Genode::Cancelable_lock::unlock()
|
|
|
|
{
|
|
|
|
assert(_state == LOCKED);
|
|
|
|
_state = UNLOCKED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Genode::Cancelable_lock::lock()
|
|
|
|
{
|
|
|
|
assert(_state == UNLOCKED);
|
|
|
|
_state = LOCKED;
|
|
|
|
}
|