Mercurial > libavcodec.hg
comparison os2thread.c @ 8129:a9734fe0811e libavcodec
Making it easier to send arbitrary structures as work orders to MT workers
| author | romansh |
|---|---|
| date | Wed, 12 Nov 2008 17:47:23 +0000 |
| parents | 8fbbe12e0c39 |
| children | d7ef6611a49e |
comparison
equal
deleted
inserted
replaced
| 8128:e2241dd85c65 | 8129:a9734fe0811e |
|---|---|
| 79 } | 79 } |
| 80 | 80 |
| 81 av_freep(&s->thread_opaque); | 81 av_freep(&s->thread_opaque); |
| 82 } | 82 } |
| 83 | 83 |
| 84 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | 84 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ |
| 85 ThreadContext *c= s->thread_opaque; | 85 ThreadContext *c= s->thread_opaque; |
| 86 int i; | 86 int i; |
| 87 | 87 |
| 88 assert(s == c->avctx); | 88 assert(s == c->avctx); |
| 89 assert(count <= s->thread_count); | 89 assert(count <= s->thread_count); |
| 90 | 90 |
| 91 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | 91 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ |
| 92 | 92 |
| 93 for(i=0; i<count; i++){ | 93 for(i=0; i<count; i++){ |
| 94 | 94 |
| 95 c[i].arg= arg[i]; | 95 c[i].arg= (char*)arg + i*size; |
| 96 c[i].func= func; | 96 c[i].func= func; |
| 97 c[i].ret= 12345; | 97 c[i].ret= 12345; |
| 98 | 98 |
| 99 DosPostEventSem(c[i].work_sem); | 99 DosPostEventSem(c[i].work_sem); |
| 100 // ReleaseSemaphore(c[i].work_sem, 1, 0); | 100 // ReleaseSemaphore(c[i].work_sem, 1, 0); |
