Start a new thread and run the worker_thread()
settings_agent.moveToThread(settingsFileUpdaterThread);
settingsFileUpdaterThread->start();
QMetaObject::invokeMethod(&settings_agent,
"worker_thread", Qt
::QueuedConnection);
QThread *settingsFileUpdaterThread = new QThread;
settings_agent.moveToThread(settingsFileUpdaterThread);
settingsFileUpdaterThread->start();
QMetaObject::invokeMethod(&settings_agent, "worker_thread", Qt::QueuedConnection);
To copy to clipboard, switch view to plain text mode
void SettingsFileRetrievalAgent::worker_thread()
{
while(1)
status = updateSettingsIfPossible();
if (status == RETURN_SUCCESS_CACHE_UPDATED)
{
emit updatedSettingsNotification(); //segfault
}
for( int count = 0; count < 2; ++count )
sleep( 1 );
}
}
void SettingsFileRetrievalAgent::worker_thread()
{
while(1)
status = updateSettingsIfPossible();
if (status == RETURN_SUCCESS_CACHE_UPDATED)
{
emit updatedSettingsNotification(); //segfault
}
for( int count = 0; count < 2; ++count )
sleep( 1 );
}
}
To copy to clipboard, switch view to plain text mode
I have other threads that are just about identical and they don't seem to have a problem when emitting a signal.
Bookmarks