[Digikam-devel] Threading in digiKam

Marcel Wiesweg marcel.wiesweg at gmx.de
Sat May 1 15:14:10 CEST 2010


> Hi Everyone!
> 
> The GSoC community bonding period has started. My exams just got over and
> I'm trying to get familiar with digiKam's workings.
> Now, a major concern is that libface's methods should be thread-safe to be
> usable in digKam.
> 
> pthreads are POSIX-only. So, I'd like to know what sort of threading
> digiKam uses. I can browse the code myself, but it'd be faster if someone
> points me to some relevant source files which make use of threading, just
> so that I can learn quicker.

Of course, we use Qt ;-) 
If you now feel the need, reconsider to build upon Qt Core at least. It's 
about as cross-platform as it gets nowadays.

Also think about if you want to have thread-safety or reentrancy:

Reentrancy is often easily achieved. Store your data in a C++ object and do 
not use any global-static data structures. Now a single object can only be 
used from a single thread, but this is usually absolutely sufficient.
If usage of global-static data is needed for optimization purposes, it is 
critical to make this thread-safe, to mutex-protect them. See above for my Qt 
hint.

Thread-safe means that the same single object can be access from multiple 
threads. This requires strict mutex protection for all methods, but is usually 
unnecessary for objects like images.

Marcel


More information about the Digikam-devel mailing list