![]() |
Max OS 0.3
|
The execution context of a sub-process thread. More...
#include <process.h>
Public Member Functions | |
| Thread (void(*_entry_point)(void *), void *args, int arg_amount, Process *parent) | |
| Constructor for the Thread class. | |
| ~Thread () | |
| Destructor for the Thread class. | |
| void | sleep (size_t milliseconds) |
| Sleeps the thread for a certain amount of time. | |
| uintptr_t | tss_pointer () const |
| Gets the stack pointer to use for the TSS when switching to this thread. | |
| void | save_sse_state () |
| Saves the SSE, x87 FPU, and MMX states from memory to the thread. | |
| void | restore_sse_state () |
| Restores the SSE, x87 FPU, and MMX states from the thread to memory. | |
| void | save_cpu_state () |
| Saves the CPU state into the thread's execution_state structure. | |
Public Attributes | |
| uint64_t | tid |
| The thread ID. | |
| uint64_t | parent_pid |
| The parent process ID. | |
| system::cpu_status_t | execution_state |
| The CPU state of the thread. | |
| thread_state_t | thread_state |
| The current state of the thread. | |
| size_t | ticks |
| The number of ticks the thread has run for. | |
| size_t | wakeup_time |
| The time at which the thread should wake up (if sleeping) | |
Constructor for the Thread class.
| _entry_point | The address of the function to start executing |
| args | The arguments to pass to the function |
| arg_amount | The number of arguments |
| parent | The proccess that owns this thread (started it) |
Definition at line 26 of file process.cpp.
References ASSERT, MaxOS::system::CPU::executing_core(), execution_state, MaxOS::memory::MemoryManager::kmalloc(), MaxOS::memory::MemoryManager::malloc(), memcpy(), parent_pid, MaxOS::processes::STACK_SIZE, thread_state, ticks, and wakeup_time.
| void Thread::restore_sse_state | ( | ) |
Restores the SSE, x87 FPU, and MMX states from the thread to memory.
Definition at line 105 of file process.cpp.
References MaxOS::system::CPU::executing_core().
| void Thread::save_cpu_state | ( | ) |
Saves the CPU state into the thread's execution_state structure.
Definition at line 118 of file process.cpp.
References execution_state.
| void Thread::save_sse_state | ( | ) |
Saves the SSE, x87 FPU, and MMX states from memory to the thread.
Definition at line 92 of file process.cpp.
References MaxOS::system::CPU::executing_core().
Referenced by MaxOS::processes::Scheduler::schedule_next().
Sleeps the thread for a certain amount of time.
| milliseconds | The amount of time to sleep for |
Definition at line 82 of file process.cpp.
References thread_state, and wakeup_time.
|
inline |
| system::cpu_status_t MaxOS::processes::Thread::execution_state |
The CPU state of the thread.
Definition at line 67 of file process.h.
Referenced by save_cpu_state(), MaxOS::processes::Scheduler::schedule_next(), Thread(), MaxOS::processes::Scheduler::yield(), and MaxOS::processes::GlobalScheduler::yield().
| uint64_t MaxOS::processes::Thread::parent_pid |
The parent process ID.
Definition at line 65 of file process.h.
Referenced by MaxOS::processes::Scheduler::current_process(), and Thread().
| thread_state_t MaxOS::processes::Thread::thread_state |
The current state of the thread.
Definition at line 68 of file process.h.
Referenced by MaxOS::processes::Scheduler::remove_process(), MaxOS::processes::Scheduler::schedule_next(), sleep(), Thread(), and MaxOS::processes::Scheduler::yield().
| size_t MaxOS::processes::Thread::ticks |
The number of ticks the thread has run for.
Definition at line 70 of file process.h.
Referenced by MaxOS::processes::Scheduler::schedule(), and Thread().
| uint64_t MaxOS::processes::Thread::tid |
The thread ID.
Definition at line 64 of file process.h.
Referenced by MaxOS::processes::Scheduler::add_process(), MaxOS::processes::Scheduler::add_thread(), MaxOS::processes::Scheduler::force_remove_process(), and MaxOS::processes::Scheduler::get_thread().
| size_t MaxOS::processes::Thread::wakeup_time |
The time at which the thread should wake up (if sleeping)
Definition at line 71 of file process.h.
Referenced by MaxOS::processes::Scheduler::schedule_next(), sleep(), and Thread().