# Relase control from main thread

**URL:** <https://forum.xojo.com/t/relase-control-from-main-thread/80867>\
**Category:** General\
**Created:** [June 29, 2024, 8:31pm UTC](https://forum.xojo.com/t/relase-control-from-main-thread/80867 "2024-06-29T20:31:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Kleban](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/a8b319/32.png) [@Ed\_Kleban](https://forum.xojo.com/u/Ed_Kleban)\
**Post date:** [June 29, 2024, 8:31pm UTC](https://forum.xojo.com/t/relase-control-from-main-thread/80867/1 "2024-06-29T20:31:08Z")

</div>

I vaguely remember that Xojo had a function that would release control of the main xojo thread so that other program processes would have a chance to run. Is there?

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [June 29, 2024, 8:35pm UTC](https://forum.xojo.com/t/relase-control-from-main-thread/80867/2 "2024-06-29T20:35:01Z")

</div>

What are you doing on the main thread that makes it run for so long? Main thread should be answering mouse clicks etc, not much more than that. Any long-running work should be done in other threads.

You could look at YieldToNext() but I expect that’s intended for long running non-main threads.

---

<div class="post-metadata">

**Author:** ![Antoine\_Beaubien](https://forum.xojo.com/user_avatar/forum.xojo.com/antoine_beaubien/32/12603_2.png) [@Antoine\_Beaubien](https://forum.xojo.com/u/Antoine_Beaubien)\
**Post date:** [June 30, 2024, 1:02pm UTC](https://forum.xojo.com/t/relase-control-from-main-thread/80867/3 "2024-06-30T13:02:27Z")

</div>

I think you are looking for [DoEvent()](https://documentation.xojo.com/api/user_interface/desktop/desktopapplication.html#desktopapplication-doevents), but it’s a cursed function that exists but should never be used, or just on console apps…

Regards, Antoine
