/* free what has been allocated by avcodec_thread_init(). must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running  */
void avcodec_thread_free(AVCodecContext *s)
/* free what has been allocated by avcodec_thread_init(). must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running  */
void avcodec_thread_free(AVCodecContext *s)
{
        c[i].func= NULL;
        DosPostEventSem(c[i].work_sem);
        DosWaitThread((PTID)&c[i].thread,DCWW_WAIT);
        if(c[i].work_sem) DosCloseEventSem(c[i].work_sem);
        if(c[i].done_sem) DosCloseEventSem(c[i].done_sem);
    }
    av_freep(&s->thread_opaque);
}