9 Feb 2004 12:54
Re: stack trace of the right thread on error
Shiro Kawai <shiro <at> lava.net>
2004-02-09 11:54:51 GMT
2004-02-09 11:54:51 GMT
Hm. I think the current behavior is straightforward implementation of SRFI-18, although SRFI-18 isn't very specific about the situation. When a thread throws an exception and where no user-defined exception handler is installed, it should call thread's "initial exception handler", which should terminate the thread. When you call thread-join! on the thread terminated by such a way, the calling thread gets uncaught-exception. So, the proper way is to handle the exception in each thread, probably using with-error-handler. (SRFI-18's with-exception-handler is very low level in terms of continuation handling; specifically, you need to use call/cc explicitly if you want to abort the operation when an exception is raised). However, it is possible to let the initial exception handler call report-error before terminating the thread, so that you can see the stack trace of the thread that raised the error. In such a case, you'll see two error strack traces (one from the error-causing thread, another from the thread that calls thread-join!) unless you handles thread's error by yourself. Try the following patch and let me know how you like. --shiro =================================================================== RCS file: /cvsroot/gauche/Gauche/ext/threads/threads.c,v retrieving revision 1.5 diff -c -r1.5 threads.c(Continue reading)
RSS Feed