Tornado programs are not written like normal code. You provide an entry point for TKernel_Program (called TKernel_Program::entry()) through which your code is called when the tornado environment has been set up. Within your entry point, you open resources, create windows etc and as each operation you do usually requires a handler to be attached, your code will be called by tornado as each thing you do specifies. Note that it is expected any handler may run when any other hander is running ie; your code must multithread. If there are any threads or portions of threads which are mutually exclusive you must prevent simultaneous execution using the tornado synchronisation objects.