Beispiel #1
0
void DynamicThread::start(QMutexLocker& locker)
{
    if (d->inDestruction)
    {
        return;
    }

    switch (d->state)
    {
        case Inactive:
        case Deactivating:
        {
            d->state = Scheduled;
            break;
        }
        case Running:
        case Scheduled:
        {
            return;
        }
    }

    if (!d->threadRequested)
    {
        // avoid issueing multiple thread requests after very fast start/stop/start calls
        d->threadRequested = true;

        locker.unlock();
        ThreadManager::instance()->schedule(d);
        locker.relock();
    }
}
static PyObject *meth_QMutexLocker_relock(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QMutexLocker *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QMutexLocker, &sipCpp))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->relock();
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QMutexLocker, sipName_relock, NULL);

    return NULL;
}