c++ - Does a class instance thread affinity have any impact on its data? -
we know qthread documentation
a qobject instance said have thread affinity, or lives in thread. when qobject receives queued signal or posted event, slot or event handler run in thread object lives in.
does thread affinity have impact on class instance data? class data become thread data?
apart above, reason asking because want pass pointer/reference of class in constructor. if being object oriented, shall not access data directly if call member function of other class, called in class's thread?
does thread affinity has impact on class data?
no, qobject's thread affinity controls thread slot , event handlers run in.
does class data becomes thread data?
class data means class static data members - can't possibly affected thread affinity of each instance. instance data isn't somehow made thread-local either: thread-local storage can limited, , there's no reason force every instance it.
apart above ...
if don't issue signal or event, normal method calls method calls.
Comments
Post a Comment