Пример #1
0
void GfxImageLoaderEngine::run()
{
    lock.lock();

    while(true) {
        if(ops.isEmpty()) {
            wait.wait(&lock);
        } else {
            Op op = *ops.begin();
            lock.unlock();

            runOp(op);

            lock.lock();
        }
    }
}
Пример #2
0
void GfxImageLoaderEngine::load(GfxImageLoader *out, const QString &filename, 
                                const QList<QSize> &sizes)
{
    lock.lock();

    bool wasEmpty = ops.isEmpty();
    Op op;
    op.filename = filename;
    op.sizes = sizes;
    op.id = id++;
    op.out = out;
    ops.insert(out, op);

    if(wasEmpty)
        wait.wakeAll();
    lock.unlock();
}