struct Current

Defined at line 1381 of file ../../zircon/kernel/include/kernel/thread.h

All of these operations implicitly operate on the current thread.

Public Methods

PreemptionState & preemption_state ()

Defined at line 1432 of file ../../zircon/kernel/include/kernel/thread.h

MemoryAllocationState & memory_allocation_state ()

Defined at line 1436 of file ../../zircon/kernel/include/kernel/thread.h

RestrictedState * restricted_state ()

Defined at line 1445 of file ../../zircon/kernel/include/kernel/thread.h

VmAspace * active_aspace ()

Defined at line 1449 of file ../../zircon/kernel/include/kernel/thread.h

VmAspace * switch_aspace (VmAspace * aspace)

Defined at line 1451 of file ../../zircon/kernel/include/kernel/thread.h

void Dump (bool full)

Defined at line 1478 of file ../../zircon/kernel/include/kernel/thread.h

void DumpDuringPanic (bool full)

Defined at line 1479 of file ../../zircon/kernel/include/kernel/thread.h

Thread * Get ()

This is defined below, just after the Thread declaration.

Defined at line 1944 of file ../../zircon/kernel/include/kernel/thread.h

void Yield ()

Yield the cpu to another thread

This function places the current thread at the end of the run queue

and yields the cpu to another waiting thread (if any.)

This function will return at some later time. Possibly immediately if

no other threads are waiting to execute.

Defined at line 1631 of file ../../zircon/kernel/kernel/thread.cc

void Preempt ()

Preempt the current thread from an interrupt

This function places the current thread at the head of the run

queue and then yields the cpu to another thread.

Defined at line 1651 of file ../../zircon/kernel/kernel/thread.cc

void Reschedule ()

Reevaluate the run queue on the current cpu.

This function places the current thread at the head of the run

queue and then yields the cpu to another thread. Similar to

thread_preempt, but intended to be used at non interrupt context.

Defined at line 1672 of file ../../zircon/kernel/kernel/thread.cc

void Exit (int retcode)

Terminate the current thread

Current thread exits with the specified return code.

This function does not return.

Defined at line 949 of file ../../zircon/kernel/kernel/thread.cc

void Kill ()

Defined at line 1119 of file ../../zircon/kernel/kernel/thread.cc

void BecomeIdle ()

Become an idle thread

This function marks the current thread as the idle thread -- the one which

executes when there is nothing else to do. This function does not return.

This thread is called once at boot on the first cpu.

Defined at line 1962 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t SleepEtc (const Deadline & deadline, Interruptible interruptible, zx_instant_mono_t now)

Put thread to sleep; deadline specified in ns

This function puts the current thread to sleep until the specified

deadline has occurred.

Note that this function could continue to sleep after the specified deadline

if other threads are running. When the deadline occurrs, this thread will

be placed at the head of the run queue.

interruptible argument allows this routine to return early if the thread was signaled

for something.

Defined at line 1782 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t Sleep (zx_instant_mono_t deadline)

Non-interruptible version of SleepEtc.

Defined at line 1837 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t SleepRelative (zx_duration_mono_t delay)

Non-interruptible relative delay version of Sleep.

Defined at line 1842 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t SleepInterruptible (zx_instant_mono_t deadline)

Interruptible version of Sleep.

Defined at line 1848 of file ../../zircon/kernel/kernel/thread.cc

void DoSuspend ()

Transition the current thread to the THREAD_SUSPENDED state.

Defined at line 1275 of file ../../zircon/kernel/kernel/thread.cc

void DoSampleStack (GeneralRegsSource source, void * gregs)

Write the current thread's stack to the assigned sampler buffers

Defined at line 1351 of file ../../zircon/kernel/kernel/thread.cc

void SignalPolicyException (uint32_t policy_exception_code, uint32_t policy_exception_data)

Signal an exception on the current thread, to be handled when the

current syscall exits. Unlike other signals, this is synchronous, in

the sense that a thread signals itself. This exists primarily so that

we can unwind the stack in order to get the state of userland's

callee-saved registers at the point where userland invoked the

syscall.

Defined at line 749 of file ../../zircon/kernel/kernel/thread.cc

void ProcessPendingSignals (GeneralRegsSource source, void * gregs)

Process any pending thread signals.

This method may never return if the thread has a pending kill signal.

Interrupt state - This method modifies interrupt state. It is critical that this method be

called with interrupts disabled to eliminate a "lost wakeup" race condition. While

interrupts must be disabled prior to call this method, the method may re-enable them during

the processing of certain signals. This method guarantees that if it does return, it will do

so with interrupts disabled.

Defined at line 1422 of file ../../zircon/kernel/kernel/thread.cc

void MigrateToCpu (cpu_num_t target_cpuid)

Migrates the current thread to the CPU identified by target_cpu.

Defined at line 1150 of file ../../zircon/kernel/kernel/thread.cc

void SetName (const char * name)

Change name of current thread

Defined at line 1912 of file ../../zircon/kernel/kernel/thread.cc

bool CheckForRestrictedKick ()

If a restricted kick is pending on this thread, clear it and return true.

Otherwise return false.

Must be called with interrupts disabled.

Defined at line 1608 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t PageFault (vaddr_t va, uint flags)

These three functions handle faults on the address space containing va. If there is no

aspace that contains va, or we don't have access to it, a ZX_ERR_NOT_FOUND is returned.

Calling any of these methods on a pure kernel thread (i.e. one without an associated

`ThreadDispatcher`) is a programming error.

May block on page requests and must be called without locks held.

Defined at line 316 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t SoftFault (vaddr_t va, uint flags)

Defined at line 320 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t SoftFaultInRange (vaddr_t va, uint flags, size_t len)

Defined at line 324 of file ../../zircon/kernel/kernel/thread.cc

zx_status_t AccessedFault (vaddr_t va)

Defined at line 329 of file ../../zircon/kernel/kernel/thread.cc

void GetBacktrace (Backtrace & out_bt)

Generate a backtrace for the calling thread.

|out_bt| will be reset() prior to be filled in and if a backtrace cannot

be obtained, it will be left empty.

Defined at line 2414 of file ../../zircon/kernel/kernel/thread.cc

void GetBacktrace (vaddr_t fp, Backtrace & out_bt)

Generate a backtrace for the calling thread starting at frame pointer |fp|.

|out_bt| will be reset() prior to be filled in and if a backtrace cannot

be obtained, it will be left empty.

Defined at line 2424 of file ../../zircon/kernel/kernel/thread.cc