Kernel: Added WaitObject and changed "waitable" objects inherit from it.
This commit is contained in:
parent
0c7498545f
commit
c22bac6398
8 changed files with 73 additions and 71 deletions
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
|
@ -92,6 +94,29 @@ inline void intrusive_ptr_release(Object* object) {
|
|||
template <typename T>
|
||||
using SharedPtr = boost::intrusive_ptr<T>;
|
||||
|
||||
/// Class that represents a Kernel object that a thread can be waiting on
|
||||
class WaitObject : public Object {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Add a thread to wait on this object
|
||||
* @param thread Pointer to thread to add
|
||||
*/
|
||||
void AddWaitingThread(Thread* thread);
|
||||
|
||||
/**
|
||||
* Resumes the next thread waiting on this object
|
||||
* @return Pointer to the thread that was resumed, nullptr if no threads are waiting
|
||||
*/
|
||||
Thread* ResumeNextThread();
|
||||
|
||||
/// Releases all threads waiting on this object
|
||||
void ReleaseAllWaitingThreads();
|
||||
|
||||
private:
|
||||
std::vector<Thread*> waiting_threads; ///< Threads waiting for this object to become available
|
||||
};
|
||||
|
||||
/**
|
||||
* This class allows the creation of Handles, which are references to objects that can be tested
|
||||
* for validity and looked up. Here they are used to pass references to kernel objects to/from the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue