comparison w32thread.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 6815571afbcf
children 560708e850a4
comparison
equal deleted inserted replaced
8128:e2241dd85c65 8129:a9734fe0811e
72 } 72 }
73 73
74 av_freep(&s->thread_opaque); 74 av_freep(&s->thread_opaque);
75 } 75 }
76 76
77 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ 77 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
78 ThreadContext *c= s->thread_opaque; 78 ThreadContext *c= s->thread_opaque;
79 int i; 79 int i;
80 80
81 assert(s == c->avctx); 81 assert(s == c->avctx);
82 assert(count <= s->thread_count); 82 assert(count <= s->thread_count);
83 83
84 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ 84 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
85 85
86 for(i=0; i<count; i++){ 86 for(i=0; i<count; i++){
87 c[i].arg= arg[i]; 87 c[i].arg= (char*)arg + i*size;
88 c[i].func= func; 88 c[i].func= func;
89 c[i].ret= 12345; 89 c[i].ret= 12345;
90 90
91 ReleaseSemaphore(c[i].work_sem, 1, 0); 91 ReleaseSemaphore(c[i].work_sem, 1, 0);
92 } 92 }