yuzu/src/core/hle/kernel/mutex.h

38 lines
1 KiB
C
Raw Normal View History

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
// Refer to the license.txt file included.
2014-05-21 03:03:45 +00:00
#pragma once
#include <string>
2014-05-21 03:03:45 +00:00
#include "common/common_types.h"
2018-01-01 19:02:26 +00:00
#include "common/swap.h"
2014-05-21 03:03:45 +00:00
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/wait_object.h"
2018-01-01 19:02:26 +00:00
#include "core/hle/result.h"
2014-05-21 03:03:45 +00:00
namespace Kernel {
class Thread;
class Mutex final {
public:
/// 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);
private:
Mutex() = default;
~Mutex() = default;
};
2014-05-21 03:03:45 +00:00
2018-01-01 19:02:26 +00:00
} // namespace Kernel