Program exiting from thread with infinite loop

Ali Çehreli acehreli at yahoo.com
Fri Jan 19 21:18:53 UTC 2018


On 01/19/2018 12:40 PM, Chris M. wrote:
 > it just runs the function once and exits every time.

I would still put the following try+catch block around the whole logic:

void deviceDownloader()
{
     try {
         // ... existing contents of the function ...
     } catch (Exception exc) {
         writeln("Error: ", exc.msg);
     } catch (Error err) {
         writeln("Unrecoverable error: ", err.msg);
     }
}

Another thing to use it to start the program under a debugger and look 
at how many threads it has. If the program is called "deneme", on the 
console:

  gdb deneme

Then, inside gdb:

run
Ctrl-C
info threads

That command lists two threads for me.

Ali



More information about the Digitalmars-d-learn mailing list