Re: Glib::Dispatcher: How to use a non-void signal for tunneling?



I've an example which might be helpfull for you. It uses a Thread, Syncing and Dispatcher ( it is not much code but many comments, unfortunately in german at the moment )

Depending what compression you prefer:
http://evilissimo-softdev.de/files/downloads/gtkmm_tut/example3/gtkmm_example3.tar.bz2
or
http://evilissimo-softdev.de/files/downloads/gtkmm_tut/example3/gtkmm_example3.tar.gz
or
http://evilissimo-softdev.de/files/downloads/gtkmm_tut/example3/gtkmm_example3.zip

This is inspired from Daniel Elstner Glib::Dispatcher example which can be found here: http://cvs.gnome.org/viewcvs/gtkmm-root/examples/thread/

BR

Vinzenz 'evilissimo' Feenstra


Matthias Kaeppler schrieb:

Vinzenz 'evilissimo' Feenstra wrote:

You may either use a threadsafe singleton and request the informations each time your signal handler is called or you pass a pointer to an object which you can ask for the data you want with a Get method or something, which of course must be threadsafe, too.


Yes, I could do that, I just hoped there would be a cleaner approach which doesn't involve altering the class interface.

As to thread-safety, can you give me any hints what I have to watch out for when programming a thread-safe getter/singleton? I am familiar with the basics of concurrency and aware of most of its more common problems such as races and deadlocks, but I have never programmed with threads in C++ before and am not familiar with the means involved there (especially since threading facilities are not implemented on the language level but have to be incorporated from 3rd party libraries--in this case glibmm I guess).

Thanks a lot,
Matthias





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]