OSInitCoroutine DEPRECATED

Syntax

#include <cafe/os.h>

void OSInitCoroutine(OSCoroutine *coroutine, void *pc, void *sp);

Parameters

coroutine Pointer to OSCoroutine to initialize.
pc Start function address for coroutine.
sp Stack pointer for coroutine.

Return Values

None.

Description

NOTE:
Although the Wii U coroutine API is not considered fully deprecated, it should not be used in new applications; threads should be used instead.

Initializes the OSCoroutine coroutine for use by specifying the new coroutine's start (function) address pc and stack pointer sp.

You should allocate storage for the stack that is large enough to support this coroutine's maximum call depth, plus 8 bytes. The stack must be 8-byte aligned and a multiple of 8 bytes long. sp must then refer to 8 bytes short of the end of the stack's storage, allowing the coroutine's stack to grow toward lower addresses.

Demos

Demos are available at the following locations.

$CAFE_ROOT/system/src/demo/os/coroutine/coroutine_simple.c
$CAFE_ROOT/system/src/demo/os/coroutine/coroutine_consumer_producer.c

Do Not Call From

Deprecated Do not call this function in new code.
Multiple threads This function is not thread-safe.
Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.
Multiple Cores Do not call this function from more than one Core.

See Also

Coroutine Overview
OSLoadCoroutine
OSSaveCoroutine
OSSwitchCoroutine

Revision History

2013/08/02 Clarify coroutine usage.
2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup Pass.
2011/03/15 Initial version.


CONFIDENTIAL