# Setting up context for the scheduler

**URL:** <https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299>\
**Category:** Kernel\
**Created:** [July 8, 2010, 11:26pm UTC](https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299 "2010-07-08T23:26:25Z")\
**Posts on this page:** 4\
**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:** [July 8, 2010, 11:26pm UTC](https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299/1 "2010-07-08T23:26:25Z")

</div>

**[jdupre](https://sourceforge.net/u/jdupre/)** wrote on [Thursday, July 08, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/914e4cff/#416e):

I use timers and interrupts prior to calling&nbsp; vTaskStartScheduler() as part of a startup routine. Aside from calling portDISABLE\_INTERRUPTS(), is there any other cleanup required to define the proper context before starting the scheduler???

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 14, 2010, 11:27am UTC](https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299/2 "2010-07-14T11:27:40Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Wednesday, July 14, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/914e4cff/#3ddd):

I’m not sure exactly what the question is, but as long as you don’t try doing a context switch before the scheduler has started you should be ok. Normally interrupts will get disabled by calling an API function if the scheduler is not started in any case.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 14, 2010, 3:59pm UTC](https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299/3 "2010-07-14T15:59:48Z")

</div>

**[jdupre](https://sourceforge.net/u/jdupre/)** wrote on [Wednesday, July 14, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/914e4cff/#5ba5):

I’m just asking what the required state be when starting the scheduler for the first time.&nbsp; As far as I know (for an ARM), it’s just:  
1) interrupts disabled.  
2) in supervisor mode.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 14, 2010, 4:12pm UTC](https://forums.freertos.org/t/setting-up-context-for-the-scheduler/3299/4 "2010-07-14T16:12:59Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Wednesday, July 14, 2010](https://sourceforge.net/p/freertos/discussion/382005/thread/914e4cff/#e9d1):

> 1) interrupts disabled.  
> 2) in supervisor mode.

That is correct. FreeRTOS will disable interrupts temporarily while the scheduler is being started in any case. Interrupts will be enabled when the first task actually starts executing (by default in any case).
