OS_SwitchThreadCallback

# OS_SetSwitchThreadCallback

## C Specification

      #include <nitro/os.h>
        typedef void (*OSSwitchThreadCallback)(

                          OSThread* from,

                          OSThread* to );

  `OSSwitchThreadCallback OS_SetSwitchThreadCallback(
  OSSwitchThreadCallback callback );`

## Arguments

callback | The callback used when threads are switched. Specify NULL to release callback.

## Return Values

The callback that was specified before this function was called. If none was set, returns NULL.

## Description

This function registers the callback function that is used when a thread context switch is generated.

Once this callback function is registered, unless it is modified or released, it will be called each time a context switch is generated.

callback takes 2 arguments. from is a pointer to the OSThread structure of the thread that was being executed before the switch. to is a pointer to the OSThread structure of the thread that will be executed next. If it is not prepared to execute, this will be NULL.

## See Also

`OS_InitThread, OS_RescheduleThread`

## Revision History

03/31/2004 Initial Version

CONFIDENTIAL