# detect the scheduler is running

**URL:** <https://forums.freertos.org/t/detect-the-scheduler-is-running/4975>\
**Category:** Kernel\
**Created:** [January 15, 2014, 5:32pm UTC](https://forums.freertos.org/t/detect-the-scheduler-is-running/4975 "2014-01-15T17:32:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 15, 2014, 5:32pm UTC](https://forums.freertos.org/t/detect-the-scheduler-is-running/4975/1 "2014-01-15T17:32:07Z")

</div>

**[williamjsell](https://sourceforge.net/u/williamjsell/)** wrote on [Wednesday, January 15, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/dcbda6d0/#7477):

A simple question. I have some pre-rtos initialization which needs to occur, but this function could be called after the scheduler is invoked. In this case, I need to detect the scheduler is running and shut down some tasks. Is there an api to indicate the scheduler is running?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 15, 2014, 5:39pm UTC](https://forums.freertos.org/t/detect-the-scheduler-is-running/4975/2 "2014-01-15T17:39:37Z")

</div>

**[woops\_](https://sourceforge.net/u/woops_/)** wrote on [Wednesday, January 15, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/dcbda6d0/#9c25):

[http://www.freertos.org/a00021.html#xTaskGetSchedulerState](http://www.freertos.org/a00021.html#xTaskGetSchedulerState)

---

<div class="post-metadata">

**Author:** ![tlafleur](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tlafleur](https://forums.freertos.org/u/tlafleur)\
**Post date:** [January 15, 2014, 6:01pm UTC](https://forums.freertos.org/t/detect-the-scheduler-is-running/4975/3 "2014-01-15T18:01:28Z")

</div>

**[tlafleur](https://sourceforge.net/u/tlafleur/)** wrote on [Wednesday, January 15, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/dcbda6d0/#7477/a66d):

Set a flag to false  
Do some initialization  
Set flag to true  
Start FreeRTOS  
Test flag…
