assert or execption case program hang in multi thread

liyu yunwind at msn.com
Sat Feb 21 02:59:19 PST 2009


maybe i should title it assert or execption can't terminate the prog in 
multithread:-)
yes, the main thread is still running, but i want the program terminated 
when a assert failure or exception happened whatever. otherwise i have to 
notify the main thread, i think that's a littel inconvenient.

"liyu" <yunwind at msn.com> wrote in message 
news:gnob29$1hcd$1 at digitalmars.com...
> code as below, assert can't terminate the program when main thread is 
> running, is it a bug or i miss something?
>
> import tango.core.Thread;
> void test()
> {
> while(1) {
> assert(false);
> //throw new Exception("test");
> }
> }
>
> void main() {
> auto thread = new Thread(&test);
> thread.start();
>
>        //if i remove the 3 lines below, then every thing work as expected
> while(1) {
> Thread.sleep(100); }
> } 




More information about the Digitalmars-d mailing list