2014-05-21 03:03:45 +00:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 05:38:14 +00:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-11-19 08:49:13 +00:00
|
|
|
// Refer to the license.txt file included.
|
2014-05-21 03:03:45 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
2018-07-31 12:06:09 +00:00
|
|
|
|
|
|
|
union ResultCode;
|
2014-05-21 03:03:45 +00:00
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2015-01-23 01:12:19 +00:00
|
|
|
class Thread;
|
|
|
|
|
2018-04-20 19:42:29 +00:00
|
|
|
class Mutex final {
|
2015-01-23 01:12:19 +00:00
|
|
|
public:
|
2018-04-20 17:01:14 +00:00
|
|
|
/// Flag that indicates that a mutex still has threads waiting for it.
|
|
|
|
static constexpr u32 MutexHasWaitersFlag = 0x40000000;
|
|
|
|
/// Mask of the bits in a mutex address value that contain the mutex owner.
|
|
|
|
static constexpr u32 MutexOwnerMask = 0xBFFFFFFF;
|
|
|
|
|
|
|
|
/// Attempts to acquire a mutex at the specified address.
|
|
|
|
static ResultCode TryAcquire(VAddr address, Handle holding_thread_handle,
|
|
|
|
Handle requesting_thread_handle);
|
|
|
|
|
|
|
|
/// Releases the mutex at the specified address.
|
|
|
|
static ResultCode Release(VAddr address);
|
|
|
|
|
2015-01-23 01:12:19 +00:00
|
|
|
private:
|
2018-04-20 19:42:29 +00:00
|
|
|
Mutex() = default;
|
|
|
|
~Mutex() = default;
|
2015-01-23 01:12:19 +00:00
|
|
|
};
|
2014-05-21 03:03:45 +00:00
|
|
|
|
2018-01-01 19:02:26 +00:00
|
|
|
} // namespace Kernel
|