Shared Class Variables

sybrandy sybrandy at gmail.com
Thu May 27 18:11:23 PDT 2010


Evening.

I'm having a bit of a problem and I'm hoping someone can help.  I'm 
trying to create a class that is shared across threads.  The only 
purpose of this class is to write data to somewhere, though currently a 
file.  A single-threaded version of this works fine, however I can't 
seem to get the code to work correctly when dealing with multiple 
threads.  I've gotten sharing issues, compilation issues trying to 
figure out how to use a shared class correctly, and currently an 
exception occurring during class finalization.

So, my question is, what is the correct way to do this?  Would a class 
work or would a struct be better?  Perhaps a singleton?

Thanks.

Casey


More information about the Digitalmars-d mailing list