New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give our threads names #4356
Give our threads names #4356
Conversation
It helps with debugging.
I should note that I didn't name the different audio drivers, like |
Hmm. So it turns out the other solution is to add I suspect there might be some reasons to not begin sprinkling Advice would be welcome - which approach should I use: call |
@Wallacoloo I think using |
By default, QThread sets its name based on the Qt meta class. To get an accurate metaclass, the class which inherits QThread must declare Q_OBJECT in its header. Futhermore, Qt's MOC requires that a Qt type be the primary base class when declaring Q_OBJECT, hence the order of base classes has been rearranged for some classes.
Okay, I've implemented this for the Midi and Audio drivers. I've also changed to use Q_OBJECT instead of I had to reorder some base classes, because the Would like for somebody to give this a quick once-over before merging to make sure I didn't do something dumb. :-) |
* Give our threads names It helps with debugging. * Use Q_OBJECT macro to automatically name threads. By default, QThread sets its name based on the Qt meta class. To get an accurate metaclass, the class which inherits QThread must declare Q_OBJECT in its header. Futhermore, Qt's MOC requires that a Qt type be the primary base class when declaring Q_OBJECT, hence the order of base classes has been rearranged for some classes.
Previously all our threads were named
QThread
. The thread name shows up when listing the processes withps
, and also when debugging ingdb
. Providing a real thread name makes stack dumps & such that much easier to read.Example before/after:
after:
Part of the text gets cut off for longer thread names, but it still gives one something to grep for, at least.