Revision 9fe08942

View differences:

libavcodec/w32thread.c
48 48
        int ret, jobnr;
49 49
//printf("thread_func %X enter wait\n", (int)v); fflush(stdout);
50 50
        WaitForSingleObject(c->work_sem, INFINITE);
51
        // avoid trying to access jobnr if we should quit
52
        if (!c->func && !c->func2)
53
            break;
51 54
        WaitForSingleObject(c->job_sem, INFINITE);
52 55
        jobnr = (*c->jobnr)++;
53 56
        ReleaseSemaphore(c->job_sem, 1, 0);
54 57
//printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
55 58
        if(c->func)
56 59
            ret= c->func(c->avctx, (uint8_t *)c->arg + jobnr*c->argsize);
57
        else if (c->func2)
58
            ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr);
59 60
        else
60
            return 0;
61
            ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr);
61 62
        if (c->ret)
62 63
            c->ret[jobnr] = ret;
63 64
//printf("thread_func %X signal complete\n", (int)v); fflush(stdout);

Also available in: Unified diff