mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 02:38:37 +12:00
semaphore_t, RSX fixes
1) GS_LOCK_WAIT_FLUSH semaphore eliminated 2) GS_LOCK_WAIT_FLIP semaphore left unused 3) cellRescSetWaitFlip/cellGcmSetWaitFlip purged: they don't wait for flip, it's a nonsense, they only generate some RSX command 4) Semaphores rewritten
This commit is contained in:
parent
71a378a3fb
commit
8e1991c1e1
13 changed files with 213 additions and 257 deletions
37
Utilities/Semaphore.h
Normal file
37
Utilities/Semaphore.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
|
||||
class semaphore_t
|
||||
{
|
||||
// semaphore mutex
|
||||
std::mutex m_mutex;
|
||||
|
||||
// semaphore condition variable
|
||||
std::condition_variable m_cv;
|
||||
|
||||
struct sync_var_t
|
||||
{
|
||||
u32 value; // current semaphore value
|
||||
u32 waiters; // current amount of waiters
|
||||
};
|
||||
|
||||
// current semaphore value
|
||||
atomic_t<sync_var_t> m_var;
|
||||
|
||||
public:
|
||||
// max semaphore value
|
||||
const u32 max_value;
|
||||
|
||||
semaphore_t(u32 max_value = 1, u32 value = 0)
|
||||
: m_var({ value, 0 })
|
||||
, max_value(max_value)
|
||||
{
|
||||
}
|
||||
|
||||
bool try_wait();
|
||||
|
||||
bool try_post();
|
||||
|
||||
void wait();
|
||||
|
||||
bool post_and_wait();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue