varenius / salsa

Code developed for the 2.3m radio telescopes SALSA in Onsala, Sweden
MIT License
16 stars 6 forks source link

Possible problem when subclassing QThread #65

Closed OshinoMoumou closed 3 years ago

OshinoMoumou commented 3 years ago

Greetings! I noticed that class Thread referred a StackOverflow post, while a recent comment to it mentioned that subclassing QThread is always the wrong thing to do, because the QThread object lives in the parent thread; ergo, slots signaled on this object run in the parent thread rather than the actual thread encapsulated by the QThread object. Signal-slot connections are the entire basis for thread synchronization in Qt. Ergo, subclassing QThread obstructs synchronization. . I'm trying to learn the usefulness of such small updates on StackOverflow. Would this comment help improve your code? I understand that such defect might not happen in real life situation. In that case, do you think this comment can help prevent future bugs (for example, when the code were reused somewhere else)? I'll really appreciate it if you could kindly give me some feedback or suggestions. Thank you very much for your time. Have a nice day!