I have an object: QHash<long, QMap<long, QList<long>>> hash; During initialization, I add keys in the main thread, where each key corresponds to the ID of a worker thread on a one-to-one basis. Then, when starting multiple threads, each thread reads the value corresponding to its own key, which is a QMap<long, QList<long>>, and then performs read and write operations on this QMap. In this scenario, will there be multi-thread competition issues?
My program always crashes after operating on the QMap, and I wonder if it's related to this issue.
-
You could show your code. That would eliminate some of the guess work for us of figuring out why your program crashes. Generally speaking it's thread-safe to have multiple readers and 0 writers. But sometimes it's not obvious where writing is occurring. It's not always clear if reading is a completely passive operation. Probably best to provide a minimal reproducible exampleWyck– Wyck2025年09月02日 15:47:05 +00:00Commented Sep 2, 2025 at 15:47