diff options
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 { | |||
| 58 | DEFAULT_STACK_SIZE = 0x4000, | 58 | DEFAULT_STACK_SIZE = 0x4000, |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | class HandleTable; | ||
| 62 | |||
| 63 | class Object : NonCopyable { | 61 | class Object : NonCopyable { |
| 64 | friend class HandleTable; | ||
| 65 | u32 handle = INVALID_HANDLE; | ||
| 66 | public: | 62 | public: |
| 67 | virtual ~Object() {} | 63 | virtual ~Object() {} |
| 68 | Handle GetHandle() const { return handle; } | 64 | |
| 65 | /// Returns a unique identifier for the object. For debugging purposes only. | ||
| 66 | unsigned int GetObjectId() const { return object_id; } | ||
| 69 | 67 | ||
| 70 | virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } | 68 | virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } |
| 71 | virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } | 69 | virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } |
| @@ -101,7 +99,10 @@ private: | |||
| 101 | friend void intrusive_ptr_add_ref(Object*); | 99 | friend void intrusive_ptr_add_ref(Object*); |
| 102 | friend void intrusive_ptr_release(Object*); | 100 | friend void intrusive_ptr_release(Object*); |
| 103 | 101 | ||
| 102 | static unsigned int next_object_id; | ||
| 103 | |||
| 104 | unsigned int ref_count = 0; | 104 | unsigned int ref_count = 0; |
| 105 | unsigned int object_id = next_object_id++; | ||
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| 107 | // Special functions used by boost::instrusive_ptr to do automatic ref-counting | 108 | // Special functions used by boost::instrusive_ptr to do automatic ref-counting |
| @@ -135,25 +136,26 @@ public: | |||
| 135 | * Add a thread to wait on this object | 136 | * Add a thread to wait on this object |
| 136 | * @param thread Pointer to thread to add | 137 | * @param thread Pointer to thread to add |
| 137 | */ | 138 | */ |
| 138 | void AddWaitingThread(Thread* thread); | 139 | void AddWaitingThread(SharedPtr<Thread> thread); |
| 139 | 140 | ||
| 140 | /** | 141 | /** |
| 141 | * Removes a thread from waiting on this object (e.g. if it was resumed already) | 142 | * Removes a thread from waiting on this object (e.g. if it was resumed already) |
| 142 | * @param thread Pointer to thread to remove | 143 | * @param thread Pointer to thread to remove |
| 143 | */ | 144 | */ |
| 144 | void RemoveWaitingThread(Thread* thead); | 145 | void RemoveWaitingThread(Thread* thread); |
| 145 | 146 | ||
| 146 | /** | 147 | /** |
| 147 | * Wake up the next thread waiting on this object | 148 | * Wake up the next thread waiting on this object |
| 148 | * @return Pointer to the thread that was resumed, nullptr if no threads are waiting | 149 | * @return Pointer to the thread that was resumed, nullptr if no threads are waiting |
| 149 | */ | 150 | */ |
| 150 | Thread* WakeupNextThread(); | 151 | SharedPtr<Thread> WakeupNextThread(); |
| 151 | 152 | ||
| 152 | /// Wake up all threads waiting on this object | 153 | /// Wake up all threads waiting on this object |
| 153 | void WakeupAllWaitingThreads(); | 154 | void WakeupAllWaitingThreads(); |
| 154 | 155 | ||
| 155 | private: | 156 | private: |
| 156 | std::vector<Thread*> waiting_threads; ///< Threads waiting for this object to become available | 157 | /// Threads waiting for this object to become available |
| 158 | std::vector<SharedPtr<Thread>> waiting_threads; | ||
| 157 | }; | 159 | }; |
| 158 | 160 | ||
| 159 | /** | 161 | /** |
| @@ -274,7 +276,6 @@ private: | |||
| 274 | }; | 276 | }; |
| 275 | 277 | ||
| 276 | extern HandleTable g_handle_table; | 278 | extern HandleTable g_handle_table; |
| 277 | extern SharedPtr<Thread> g_main_thread; | ||
| 278 | 279 | ||
| 279 | /// The ID code of the currently running game | 280 | /// The ID code of the currently running game |
| 280 | /// TODO(Subv): This variable should not be here, | 281 | /// TODO(Subv): This variable should not be here, |