Mercurial > libavcodec.hg
comparison pthread.c @ 8333:09aafff47bc0 libavcodec
Avoid invasion of POSIX-reserved _t namespace.
| author | diego |
|---|---|
| date | Mon, 15 Dec 2008 21:02:17 +0000 |
| parents | a9734fe0811e |
| children | 04423b2f6e0b |
comparison
equal
deleted
inserted
replaced
| 8332:57d9d1f7955a | 8333:09aafff47bc0 |
|---|---|
| 23 */ | 23 */ |
| 24 #include <pthread.h> | 24 #include <pthread.h> |
| 25 | 25 |
| 26 #include "avcodec.h" | 26 #include "avcodec.h" |
| 27 | 27 |
| 28 typedef int (action_t)(AVCodecContext *c, void *arg); | 28 typedef int (action_func)(AVCodecContext *c, void *arg); |
| 29 | 29 |
| 30 typedef struct ThreadContext { | 30 typedef struct ThreadContext { |
| 31 pthread_t *workers; | 31 pthread_t *workers; |
| 32 action_t *func; | 32 action_func *func; |
| 33 void *args; | 33 void *args; |
| 34 int *rets; | 34 int *rets; |
| 35 int rets_count; | 35 int rets_count; |
| 36 int job_count; | 36 int job_count; |
| 37 int job_size; | 37 int job_size; |
| 99 pthread_cond_destroy(&c->last_job_cond); | 99 pthread_cond_destroy(&c->last_job_cond); |
| 100 av_free(c->workers); | 100 av_free(c->workers); |
| 101 av_freep(&avctx->thread_opaque); | 101 av_freep(&avctx->thread_opaque); |
| 102 } | 102 } |
| 103 | 103 |
| 104 int avcodec_thread_execute(AVCodecContext *avctx, action_t* func, void *arg, int *ret, int job_count, int job_size) | 104 int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size) |
| 105 { | 105 { |
| 106 ThreadContext *c= avctx->thread_opaque; | 106 ThreadContext *c= avctx->thread_opaque; |
| 107 int dummy_ret; | 107 int dummy_ret; |
| 108 | 108 |
| 109 if (job_count <= 0) | 109 if (job_count <= 0) |
