Skip to content

OS_TaskPrepare should propagate return code. #565

@jphickey

Description

@jphickey

Describe the bug
In the internal OS_TaskPrepare() routine, it calls a low-level implementation routine but does not propagate the return code.

To Reproduce
More theoretical than real. In POSIX this depends on the underlying pthread_setspecific() routine returning an error, of which the only documented error (at least per POSIX) is ENOMEM. However that doesn't mean that there couldn't be other implementation-specific errors on other systems.

Expected behavior
If the OS_TaskRegister_Impl() fails, this result should be propagated up the stack and prevent the task from starting.

Code snips
See here:

if (return_code == OS_SUCCESS)
{
OS_TaskRegister_Impl(task_id);
}
else
{
*entrypt = NULL;
}

System observed on:

Additional context
If this fails then it means dependent routines like OS_TaskGetId() will also be broken, so it really should block startup of the task and return the error to the caller. Catching this type of error early, when possible, is usually better than getting an obfuscated error later.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions