Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

void  OS_TLS_SetValue (OS_TCB    *p_tcb,

...

                       OS_TLS_ID  id,

...

                       OS_TLS     value,

...

                       OS_ERR    *p_err);

...

...

File

...

Called from

...

Code enabled by

...

os_tls.c

...

Task

...

OS_CFG_TLS_TBL_SIZE

...

OS_TLS_SetValue() allows your application to set the value of a TLS (thread-local storage) entry in the specified task’s OS_TCB. Specifically, this function assigns value to p_tcb->TLS_Tbl[id]. See Chapter 20Chapter 20, “Thread Safety of the Compiler’s Run-Time Library” on page 419 for details on TLS. Anchor10780401078040

Arguments

Anchor10780411078041p_tcb Anchor10780421078042

is a pointer to the OS_TCB of the task you wish to assign the TLS value to. value will thus be assigned to p_tcb->TLS_Tbl[id].

Anchor10780431078043id Anchor10780441078044

is the TLS ID of the entry you are setting.

...

value Anchor10780461078046

is the value to store at p_tcb->TLS_Tbl[id].

...

p_err Anchor10780481078048

is a pointer to a variable that contains an error code returned by this function. Possible values are:

...

...

OS_ERR_NONE

...

classWebWorks_Indent_2

...

if the call was successful and the caller was returned the value.

...

classWebWorks_Indent_1

...

...

OS_ERR_OS_NOT_RUNNING

...

...

if you called OS_TLS_SetValue() and the kernel has not started yet. However, it’s acceptable to call this function prior to starting multitasking but in this case, you must specify a non-NULL pointer for p_tcb.

...

classWebWorks_Indent_1

...

OS_ERR_TLS_ID_INVALID

...

classWebWorks_Indent_2

...

if you called OS_TLS_GetValue() and specified a TLS ID that has not been assigned. See OS_TLS_GetID() about assigning TLS IDs.

...

classWebWorks_Indent_1

...

OS_ERR_TLS_NOT_EN

...

...

if you called OS_TLS_SetValue() but the task was created with the option OS_OPT_TASK_NO_TLS indicating that the task does not need TLS support.

...

Returned Value

...

None Anchor10780591078059

Notes/Warnings

...

You cannot call OS_TLS_SetValue() for a task until that task gets created. Anchor10780611078061

Example

...

rowspan13

...