rpcsx/rpcs3/Emu/Cell/lv2/sys_sync.h
Ivan da7472fe81 Optimizations (#1680)
* Optimizations

1) Some headers simplified for better compilation time
2) Some templates simplified for smaller executable size
3) Eliminate std::future to fix compilation for mingw64
4) PKG installation can be cancelled now
5) cellGame fixes
6) XAudio2 fix for mingw64
7) PPUInterpreter bug fixed (Clang)

* any_pod<> implemented

Aliases: any16, any32, any64
rsx::make_command fixed
2016-04-25 13:49:12 +03:00

72 lines
1.3 KiB
C++

#pragma once
#include "Utilities/SleepQueue.h"
namespace vm { using namespace ps3; }
// attr_protocol (waiting scheduling policy)
enum
{
// First In, First Out
SYS_SYNC_FIFO = 1,
// Priority Order
SYS_SYNC_PRIORITY = 2,
// Basic Priority Inheritance Protocol (probably not implemented)
SYS_SYNC_PRIORITY_INHERIT = 3,
// Not selected while unlocking
SYS_SYNC_RETRY = 4,
//
SYS_SYNC_ATTR_PROTOCOL_MASK = 0xF,
};
// attr_recursive (recursive locks policy)
enum
{
// Recursive locks are allowed
SYS_SYNC_RECURSIVE = 0x10,
// Recursive locks are NOT allowed
SYS_SYNC_NOT_RECURSIVE = 0x20,
//
SYS_SYNC_ATTR_RECURSIVE_MASK = 0xF0, //???
};
// attr_pshared
enum
{
SYS_SYNC_NOT_PROCESS_SHARED = 0x200,
};
// attr_adaptive
enum
{
SYS_SYNC_ADAPTIVE = 0x1000,
SYS_SYNC_NOT_ADAPTIVE = 0x2000,
};
extern std::mutex& get_current_thread_mutex();
extern std::condition_variable& get_current_thread_cv();
// Simple class for global mutex to pass unique_lock and check it
struct lv2_lock_t
{
using type = std::unique_lock<std::mutex>;
type& ref;
lv2_lock_t(type& lv2_lock)
: ref(lv2_lock)
{
Expects(ref.owns_lock());
Expects(ref.mutex() == &mutex);
}
operator type&() const
{
return ref;
}
static type::mutex_type mutex;
};
#define LV2_LOCK lv2_lock_t::type lv2_lock(lv2_lock_t::mutex)