# OS_SaveContext

## C Specification

  `#include <nitro/os.h>`
  `BOOL OS_SaveContext( OSContext* context );`

## Description

This function stores the current context in the specified context structure, and is used for swapping context in the thread system. When the current thread switches to the previously stored context, the execution location is directly after when the context was stored. However, it is unclear in this case whether it is returning from this function after restarting or is returning after only being saving. For this reason, the return value has been modified for this function. The function returns with "0," but "1" is stored as `R0`. By doing so, when the context is swapped, the return value (R0) becomes "1" and this can be distinguished from a function call that only stores. See `OS_InitContext()` for details on the context content.

## Arguments

`context` | Context

## Return Values

A value of "0" indicates that it will return after the context is stored. A value of "1" indicates that it will return to this function after the context is swapped.

## See Also

`OS_InitContext, OS_LoadContext, OS_DumpContext
`

## Revision History

12/01/2003 Initial Version