diff options
author | bunnei <bunneidev@gmail.com> | 2015-02-02 19:04:04 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-02-02 19:04:04 +0100 |
commit | 7f730ed158bc9bba064100b9644b318134ef0bb3 (patch) | |
tree | c4181a69ff882e1af1b7d65bf3596a6cb3dd88b9 /src/core/hle/kernel/kernel.h | |
parent | Merge pull request #517 from bunnei/blend-factors (diff) | |
parent | Kernel: Stop creating useless Handles during object creation (diff) | |
download | yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar.gz yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar.bz2 yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar.lz yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar.xz yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.tar.zst yuzu-7f730ed158bc9bba064100b9644b318134ef0bb3.zip |
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r-- | src/core/hle/kernel/kernel.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 9860479ac..4d8e388b6 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -58,14 +58,12 @@ enum { DEFAULT_STACK_SIZE = 0x4000, }; -class HandleTable; - class Object : NonCopyable { - friend class HandleTable; - u32 handle = INVALID_HANDLE; public: virtual ~Object() {} - Handle GetHandle() const { return handle; } + + /// Returns a unique identifier for the object. For debugging purposes only. + unsigned int GetObjectId() const { return object_id; } virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } @@ -101,7 +99,10 @@ private: friend void intrusive_ptr_add_ref(Object*); friend void intrusive_ptr_release(Object*); + static unsigned int next_object_id; + unsigned int ref_count = 0; + unsigned int object_id = next_object_id++; }; // Special functions used by boost::instrusive_ptr to do automatic ref-counting @@ -135,25 +136,26 @@ public: * Add a thread to wait on this object * @param thread Pointer to thread to add */ - void AddWaitingThread(Thread* thread); + void AddWaitingThread(SharedPtr<Thread> thread); /** * Removes a thread from waiting on this object (e.g. if it was resumed already) * @param thread Pointer to thread to remove */ - void RemoveWaitingThread(Thread* thead); + void RemoveWaitingThread(Thread* thread); /** * Wake up the next thread waiting on this object * @return Pointer to the thread that was resumed, nullptr if no threads are waiting */ - Thread* WakeupNextThread(); + SharedPtr<Thread> WakeupNextThread(); /// Wake up all threads waiting on this object void WakeupAllWaitingThreads(); private: - std::vector<Thread*> waiting_threads; ///< Threads waiting for this object to become available + /// Threads waiting for this object to become available + std::vector<SharedPtr<Thread>> waiting_threads; }; /** @@ -274,7 +276,6 @@ private: }; extern HandleTable g_handle_table; -extern SharedPtr<Thread> g_main_thread; /// The ID code of the currently running game /// TODO(Subv): This variable should not be here, |