Hello everyone!
I would like to find a nice solution to the following requirement. I need a globally accessible object, say an application wide Config. I use it in many places and preferably I would like to be able to access config variables anywhere in my code with config.variable. If it really really has to be, then I would accept the config->variable syntax implying that in this case Config is a pointer, which would bug me to no end because so far I made do without any pointers at all. Pointers are evil.
Anyhow, the real complication is that my application has two threads. The gui thread and a worker thread. In the gui thread the config can be changed and then the worker thread has to be updated with the changes in a thread safe way. And there are many objects living in the worker thread, all of which need to have access to the Config object.
So I'm asking you, how would you go about it?
Bookmarks