예제 #1
0
QcepObject::~QcepObject()
{
#ifndef QT_NO_DEBUG
  QThread *currTh = QThread::currentThread();
  QThread *objTh  = thread();

  if (objTh && currTh != objTh) {
    printf("Deleting object from different thread %s (%s, %s)\n",
           qPrintable(objectName()),
           qPrintable(currTh ? currTh->objectName() : "null"),
           qPrintable(objTh ? objTh->objectName() : "null"));
  }
#endif

  s_ObjectDeleteCount.fetchAndAddOrdered(1);

#ifndef QT_NO_DEBUG
  s_Allocated.remove(this);
#endif
}
예제 #2
0
파일: utils.cpp 프로젝트: Daniel1892/tora
    void toSetThreadName(QThread const& p)
    {
        // This was copied from QT trunk - as of 4.8.2 it is not used yet
        QByteArray objectName = p.objectName().toLatin1();
        if (objectName.isEmpty())
            objectName = p.metaObject()->className();
#if defined(__linux__)
        prctl(PR_SET_NAME, (unsigned long)objectName.constData(), 0, 0, 0);
#elif defined(Q_OS_MAC)
        pthread_setname_np(objectName.constData());
#endif
    }
예제 #3
0
void Application::reportException(QString text)
{
	QThread* main = this->thread();
	QThread* current = QThread::currentThread();
	QString threadName = current->objectName();
	if (threadName.isEmpty())
	{
		if (main==current)
			threadName = "MAIN";
		else
			threadName = "SECONDARY";
	}

	reportError(QString("Exception caught: [%1]\nin thread [%2]").arg(text).arg(threadName));
}