Singleton question (shared class)

Mars - at -.-
Wed Jan 25 06:35:15 PST 2012


Hello everybody.
I have a few classes which I want to implement as singletons 
(like configuration, database connection, etc.), because I have 
to access them throughout my whole program, and from different 
threads. I'm implementing the singletons like this:
http://pastie.org/private/nltc3suxxuq6zyc6nqpdow
(I've read there's some bug if implementing them this way, but 
I'll deal with that later...)

Now to my actualy question/problem. My database (MySQL) class 
interfaces with C. So I constantly have to cast shared data, to 
get it in and out. And since I'm still a little insecure about 
shared, I'm wondering if that's okay. Example:
http://pastie.org/private/vd7qfh8b9c1chjnrimpp9a

If it's not... what's the right way to do this?

Mars


More information about the Digitalmars-d-learn mailing list