The mutex used in the first suggestion doesn't make sense. You create a local mutex and destroy it in the same method which means each call to the method creates a separate mutex, so there is no synchronisation.

@Marcel: Mutexes in Qt are extremely fast, so there won't be any noticable slowdown, provided that any thread doesn't hold the mutex longer than necessary.