Proper way to code multithreaded applications?

Jason House jason.james.house at gmail.com
Sat Jun 2 09:46:53 PDT 2007


torhu wrote:
> I don't think you need more than this to fix that problem:
> 
> void debugOutput(char[] msg)
> {
>     synchronized(derr) {
>         derr.writeLine(msg);
>         derr.flush();  // might be a good idea  in case of redirection
>     }
> }

Of course, that loses a lot of the functionality of derr.writefln, but 
something more advanced could be done...

Sadly, that really isn't my big problem right now... I need to figure 
out how to sleep without crashing!

Program received signal SIGUSR1, User defined signal 1.
[Switching to Thread 1107310912 (LWP 30890)]
0x00002abf6306d881 in ?? () from /lib/libpthread.so.0
(gdb) up
#1  0x000000000044bcaf in _D6search19pureMonteCarloSlave3runMFZi (
     this=@0x2abf62c5f400) at search.d:131
131                                     nanosleep(&tv, null);
Current language:  auto; currently minimal


More information about the Digitalmars-d-learn mailing list