[GCompris-devel] Mutex handling in Download manager

Johnny Jazeix jazeix at gmail.com
Thu Aug 27 08:26:57 UTC 2015


Hi,

I found a potential deadlock in the DownloadManager.

For some activities, we try to load two rcc in a row: for lang or
hangman, we need to load words and localized voices.

What is actually done is to load the words.rcc and when loaded, we
load the voice.

Coding speaking, on onStart activity, we call the registerResource for
words which locks the rcMutex. Then, as we have connected the
DownloadManager::resourceRegistered to the
activity.resourceRegistered, this one calls the Activity.start which
tries to load the localized voices which will call the
registerResource and try to lock the (already locked) rcMutex...

Is there a good practice to avoid that or can we just unlock the mutex
before emitting the resourceRegister signal?

We could also, load the two rcc in the onStart method and waiting for
both rcc to be loaded to start the activity.

Johnny


More information about the GCompris-devel mailing list