added possibility to kill thread on exit (i.e. exit without cleanup like closing resource descriptors)