fix(unix): Add foreign Qt threds in legacy POSIX thread impl
This commit is contained in:
parent
aaef600ffa
commit
b0985a2740
2 changed files with 16 additions and 1 deletions
|
|
@ -517,13 +517,27 @@ void ArchMultithreadPosix::startSignalHandler()
|
||||||
|
|
||||||
ArchThreadImpl *ArchMultithreadPosix::find(pthread_t thread)
|
ArchThreadImpl *ArchMultithreadPosix::find(pthread_t thread)
|
||||||
{
|
{
|
||||||
ArchThreadImpl *impl = findNoRef(thread);
|
ArchThreadImpl *impl = findNoRefOrInsert(thread);
|
||||||
if (impl != nullptr) {
|
if (impl != nullptr) {
|
||||||
refThread(impl);
|
refThread(impl);
|
||||||
}
|
}
|
||||||
return impl;
|
return impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArchThreadImpl *ArchMultithreadPosix::findNoRefOrInsert(pthread_t thread)
|
||||||
|
{
|
||||||
|
ArchThreadImpl *impl = findNoRef(thread);
|
||||||
|
if (impl == nullptr) {
|
||||||
|
// create thread for calling thread which isn't in our list and
|
||||||
|
// add it to the list. this can happen when a foreign thread
|
||||||
|
// (e.g. a Qt thread) calls into the arch layer.
|
||||||
|
impl = new ArchThreadImpl;
|
||||||
|
impl->m_thread = thread;
|
||||||
|
insert(impl);
|
||||||
|
}
|
||||||
|
return impl;
|
||||||
|
}
|
||||||
|
|
||||||
ArchThreadImpl *ArchMultithreadPosix::findNoRef(pthread_t thread)
|
ArchThreadImpl *ArchMultithreadPosix::findNoRef(pthread_t thread)
|
||||||
{
|
{
|
||||||
// linear search
|
// linear search
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ private:
|
||||||
|
|
||||||
ArchThreadImpl *find(pthread_t thread);
|
ArchThreadImpl *find(pthread_t thread);
|
||||||
ArchThreadImpl *findNoRef(pthread_t thread);
|
ArchThreadImpl *findNoRef(pthread_t thread);
|
||||||
|
ArchThreadImpl *findNoRefOrInsert(pthread_t thread);
|
||||||
void insert(ArchThreadImpl *thread);
|
void insert(ArchThreadImpl *thread);
|
||||||
void erase(const ArchThreadImpl *thread);
|
void erase(const ArchThreadImpl *thread);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue