Proper way to code multithreaded applications?

torhu fake at address.dude
Sat Jun 2 10:13:55 PDT 2007


Jason House wrote:
> 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...
> 

You probably know this, but since I've written it out already...

void debugOutput(...)
{
     synchronized(derr) {
         derr.writefx(_arguments, _argptr, true);
         derr.flush();
     }
}

Sorry I can't help you with the other problem, haven't run into that.


More information about the Digitalmars-d-learn mailing list