[Qt-interest] Handling translations in a multi-threaded server
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Thu May 19 16:41:14 CEST 2011
> Sent: Thursday, 19 May 2011 22:09 PM
>
> > Hi Konrad,
> >
> > Not at all. I was coming to the same conclusion myself -
> load them all in a
> > QHash<QString, QTranslator *>. Luckily, the
> QTranslator::translate method
> > is const, so multi-threaded access should not require locking.
>
> The constness means nothing. It's not marked as reentrant or
> thread-safe, therefore you must assume that it's not safe to use it
> from multiple threads (with or without locking).
>
> --
> Giuseppe D'Angelo
Thanks Giuseppe,
You're correct. I've reread the Qt Reentrancy and Thread-Safety section. These are only error messages, so the locking won't occur very often.
Thanks!
Tony
More information about the Qt-interest-old
mailing list