nn::os::ManagedThread::TryInitialize Member Function

Syntax

#include <nn/os.h>

template <typename T, typename U, typename Stack>
nn::Result TryInitialize(
     void(*)(T) f,
     U param,
     Stack & stack,
     s32 priority = PRIORITY_DEFAULT,
     s32 coreNo = CORE_NO_DEFAULT
);

Template Arguments

Name Description
T Data type of argument(s) of the function to run (this type must be copyable).
U A type that can be converted to T.
Stack Type representing stacks.

Parameters

Name Description
in f Pointer to the function that will run on the created thread.
in param Parameter to pass for the f argument.
in stack Object representing the stack region.
in priority Priority of the thread being created.
in coreNo Preferred processor for the thread being created.

Return Values

Returns the function's execution result.

Description

Specifies a buffer for the stack and creates a thread.

Uses the buffer specified by the user for a stack and creates a thread. To actually begin the processing of the thread you need to call Start.

param is copied to the buffer once the value has been passed as the stack, and then passed from there as the f argument.

The stack argument must be a class instance that has the GetStackBottom member function (which returns an uptr type value as the address of the bottom of the stack) and the GetStackSize member function (which returns a size_t type value for the stack size. StackBuffer satisfies these conditions and can be used as the argument.

You need to call InitializeEnvironment before using ManagedThread.

Revision History

2012/04/13
Initial version.

CONFIDENTIAL