Proper way to code multithreaded applications?

Frank Benoit keinfarbton at googlemail.com
Sat Jun 2 10:00:34 PDT 2007


Hehe, this is no crash.
This is the garbage collector stopping all threads.
You need to configure GDB to ignore SIGUSR1 and SIGUSR2.

in GDB type
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint

or make a startup skript or something like that.


Jason House schrieb:
> 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