Alarms don't work well with threads. What is generally done, is to start
a separate timer thread, and use shared variables to communicate between the 2. Probably if your prog.exe hangs, you will need to kill it by it's pid (or whatever on windows). So start your prog.exe in a thread, get it's pid and put it in a shared variable. At the same time, start your timer in another thread ( or in a Tk::After in main). When it timeouts, read the pid from the shared variable and kill it, if it hasn't finished.