本文整理汇总了C++中QAbstractEventDispatcher::metaObject方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractEventDispatcher::metaObject方法的具体用法?C++ QAbstractEventDispatcher::metaObject怎么用?C++ QAbstractEventDispatcher::metaObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractEventDispatcher
的用法示例。
在下文中一共展示了QAbstractEventDispatcher::metaObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLimits
void LimitTest::testLimits(QCoreApplication &a) {
QAbstractEventDispatcher *ed = QAbstractEventDispatcher::instance();
if (QLatin1String(ed->metaObject()->className()) != QLatin1String("QEventDispatcherGlib"))
qWarning("Not running with glib. While you may be able to open more descriptors, sockets above %d will not work", FD_SETSIZE);
qWarning("Running descriptor test.");
int count;
QList<QFile *> ql;
for (count=0;count < 524288; ++count) {
QFile *qf = new QFile(a.applicationFilePath());
if (qf->open(QIODevice::ReadOnly))
ql.prepend(qf);
else
break;
if ((count & 1023) == 0)
qWarning("%d descriptors...", count);
}
foreach(QFile *qf, ql)
delete qf;
ql.clear();
qCritical("Managed to open %d descriptors", count);
qm = new QMutex();
qw = new QWaitCondition();
qstartw = new QWaitCondition();
int fdcount = count / 8;
if (sizeof(void *) < 8)
if (fdcount > 1024)
fdcount = 1024;
QList<LimitTest *> qtl;
for (count=0;count < fdcount; ++count) {
LimitTest *t = new LimitTest();
t->tid = count;
qtl << t;
qm->lock();
t->start();
qstartw->wait(qm);
qm->unlock();
if (! t->isRunning())
break;
if ((count & 511) == 0)
qWarning("%d threads...", count);
}
qm->lock();
qw->wakeAll();
qm->unlock();
foreach(LimitTest *qt, qtl) {
if (! qt->wait(1000)) {
qWarning("Thread %d failed to terminate...", qt->tid);
qt->terminate();
}
}
qFatal("Managed to spawn %d threads", count);
}