# Where does execution start?

**URL:** <https://forum.xojo.com/t/where-does-execution-start/27281>\
**Category:** Getting Started\
**Created:** [October 16, 2015, 10:03am UTC](https://forum.xojo.com/t/where-does-execution-start/27281 "2015-10-16T10:03:41Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [October 16, 2015, 10:03am UTC](https://forum.xojo.com/t/where-does-execution-start/27281/1 "2015-10-16T10:03:41Z")

</div>

What is the equivalent of main() in C? Where should I put what will be my (copious) initialisation code?

Thanks,

---

<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:** [October 16, 2015, 10:15am UTC](https://forum.xojo.com/t/where-does-execution-start/27281/3 "2015-10-16T10:15:31Z")

</div>

Merci!

---

<div class="post-metadata">

**Author:** ![Will\_Shank](https://forum.xojo.com/letter_avatar_proxy/v4/letter/w/f475e1/32.png) [@Will\_Shank](https://forum.xojo.com/u/Will_Shank)\
**Post date:** [October 16, 2015, 10:41am UTC](https://forum.xojo.com/t/where-does-execution-start/27281/4 "2015-10-16T10:41:53Z")

</div>

App.Constructor happens first. That may not be where you want initialization code though.

---

<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:** [April 17, 2016, 4:24pm UTC](https://forum.xojo.com/t/where-does-execution-start/27281/5 "2016-04-17T16:24:40Z")

</div>

The initialisation of my app takes a little while (well, not in human terms, perhaps). But the app has to initialise, and then the window the user sees has to initialise. Trouble is, to do this it needs information from the initialisation of the app.

How can I prevent this race condition? Trouble is, all these open events are overlapping.

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [April 17, 2016, 4:29pm UTC](https://forum.xojo.com/t/where-does-execution-start/27281/6 "2016-04-17T16:29:17Z")

</div>

I’m assuming you are seeing an actual issue and not just inferring there is an issue…

1. What specific issue are you seeing?
2. Where are you doing the initialization?
3. Are you using timers or threads to do the initialization?

---

<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:** [April 17, 2016, 5:37pm UTC](https://forum.xojo.com/t/where-does-execution-start/27281/7 "2016-04-17T17:37:29Z")

</div>

Hmm, false alarm. I shouldn’t be putting any initialisation-dependent code into an open handler (at least, in my case). Sorry for the noise.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:00pm UTC](https://forum.xojo.com/t/where-does-execution-start/27281/8 "2020-10-29T18:00:20Z")

</div>


