mirror of
https://github.com/devkitPro/wut.git
synced 2026-08-28 05:45:03 -05:00
wutstdc++: Check if memory allocations were successful on thread creation
This commit is contained in:
@@ -24,9 +24,16 @@ __wut_thread_create(OSThread **outThread,
|
||||
void *entryArgs)
|
||||
{
|
||||
OSThread *thread = (OSThread *)memalign(16, sizeof(OSThread));
|
||||
char *stack = (char *)memalign(16, __WUT_STACK_SIZE);
|
||||
if (!thread) {
|
||||
return ENOMEM;
|
||||
}
|
||||
memset(thread, 0, sizeof(OSThread));
|
||||
|
||||
char *stack = (char *)memalign(16, __WUT_STACK_SIZE);
|
||||
if (!stack) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if (!OSCreateThread(thread,
|
||||
(OSThreadEntryPointFn)entryPoint,
|
||||
(int)entryArgs,
|
||||
|
||||
Reference in New Issue
Block a user