June 18, 2012
and something I forgot to ask, is it a conscious decision to not print out fired asserts in treads? Normally when an assert fails my whole program crashes and I can see what went wrong. With treads however, it quietly dies.
June 18, 2012
On Monday, 18 June 2012 at 13:22:24 UTC, maarten van damme wrote:
> and something I forgot to ask, is it a conscious decision to not print out fired asserts in treads? Normally when an assert fails my whole program crashes and I can see what went wrong. With treads however, it quietly dies.

 Be horrible if a kernel died due to a program's assert and throws wouldn't it? Since all programs are effectively threads or separate processes. Since a thread is just a branch of the main program, it can only go up the stack as much as it's stack is present (or that's how I see it working).

 I haven't done thread programming yet, but sometimes when using VisualD when it breaks due to an assert it wouldn't give any detailed information. In those cases I used a try/catch...


void threadedFunction(){
  //global try/catch
  try {
    //your function code
  } catch(Throwable o) {
    writeln(o);
    //still dies afterwards
  }
}


June 21, 2012
On Monday, June 18, 2012 15:22:15 maarten van damme wrote:
> and something I forgot to ask, is it a conscious decision to not print out fired asserts in treads? Normally when an assert fails my whole program crashes and I can see what went wrong. With treads however, it quietly dies.

It could be a bug. I don't know. Certainly, having the thread die will not necesasrily take your whole program down, regardless of why it died, but having it not print out anything an assertion failure is certainly undesirable. At minimum, creating an enhancement request would probably be in order, and it may just outright be a bug. A message might be sent to the parent TID. I'd have to reread TDPL's concurrency chapter and mess around with std.concurrency a bit to remember/figure out some of those details though (and regardless of what TDPL says, the current implementation may not match it).

- Jonathan M Davis
1 2 3
Next ›   Last »