Kernel: pass ref to thread
This commit is contained in:
parent
9565091fc2
commit
d940293d32
5 changed files with 37 additions and 29 deletions
|
@ -55,21 +55,6 @@ enum class ThreadWakeupReason {
|
|||
|
||||
class Thread final : public WaitObject {
|
||||
public:
|
||||
/**
|
||||
* Creates and returns a new thread. The new thread is immediately scheduled
|
||||
* @param name The friendly name desired for the thread
|
||||
* @param entry_point The address at which the thread should start execution
|
||||
* @param priority The thread's priority
|
||||
* @param arg User data to pass to the thread
|
||||
* @param processor_id The ID(s) of the processors on which the thread is desired to be run
|
||||
* @param stack_top The address of the thread's stack top
|
||||
* @param owner_process The parent process for the thread
|
||||
* @return A shared pointer to the newly created thread
|
||||
*/
|
||||
static ResultVal<SharedPtr<Thread>> Create(std::string name, VAddr entry_point, u32 priority,
|
||||
u32 arg, s32 processor_id, VAddr stack_top,
|
||||
SharedPtr<Process> owner_process);
|
||||
|
||||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
|
@ -225,18 +210,22 @@ public:
|
|||
std::function<WakeupCallback> wakeup_callback;
|
||||
|
||||
private:
|
||||
Thread();
|
||||
explicit Thread(KernelSystem&);
|
||||
~Thread() override;
|
||||
|
||||
friend class KernelSystem;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets up the primary application thread
|
||||
* @param kernel The kernel instance on which the thread is created
|
||||
* @param entry_point The address at which the thread should start execution
|
||||
* @param priority The priority to give the main thread
|
||||
* @param owner_process The parent process for the main thread
|
||||
* @return A shared pointer to the main thread
|
||||
*/
|
||||
SharedPtr<Thread> SetupMainThread(u32 entry_point, u32 priority, SharedPtr<Process> owner_process);
|
||||
SharedPtr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u32 priority,
|
||||
SharedPtr<Process> owner_process);
|
||||
|
||||
/**
|
||||
* Returns whether there are any threads that are ready to run.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue