Thread Support in Qt
summary
Qt 4 provides concrete threading primitives: QThread is a QObject you subclass and override run, it emits started/finished signals and you must avoid terminate; per-thread event loops give each QObject a thread affinity so events and queued connections go to the receiver’s thread. Synchronization tools include QMutex/QMutexLocker (RAII), QWaitCondition (wait unlocks the mutex), QSemaphore for producer/consumer, QReadWriteLock and QThreadStorage (pointers only). Implicit sharing moves to atomic reference counting so copy‑on‑write is safe but objects themselves still require mutexes to mutate.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 3:33Threading overview in Qt
- 6:44QThread class basics
- 9:56Sharing data between threads
- 14:15QMutex and QMutexLocker
- 16:27QWaitCondition for synchronization
- 18:57QSemaphore in Qt 3 and 4
- 21:02QReadWriteLock for readers
- 23:07QThreadStorage for thread-local data
- 25:55Posting events between threads
- 28:00Signals and slots in threads
- 31:56Implicit sharing and threads
- 37:04Thread safety limitations
