OSSetThreadAffinity

Syntax

#include <cafe/os.h>
    
BOOL OSSetThreadAffinity(OSThread* thread, u16 affinity);

Parameters

thread Pointer to thread control block.
affinity Core affinity set via OR bitmask of the following values.
OS_THREAD_ATTR_AFFINITY_CORE0 Specify Core 0 to run the thread.
OS_THREAD_ATTR_AFFINITY_CORE1 Specify Core 1 to run the thread.
OS_THREAD_ATTR_AFFINITY_CORE2 Specify Core 2 to run the thread.

Return Values

TRUE if the function succeeds. Otherwise, FALSE

Description

Migrates a thread from one core to another core. A thread may have an affinity for more than 1 core. The thread must be asleep or not executing on any core for the call to succeed. The call may fail if the thread is currently executing.

You should not attempt to change the affinity for the default thread for a processor. When OSSetThreadAffinity is called on a default thread for a processor, it causes an OSPanic.

Do Not Call From

None.

See Also

OSCreateThread
OSGetThreadAffinity

Revision History

2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup pass.
2010/12/27 Initial version.


CONFIDENTIAL