[FFmpeg-devel] [PATCH 1/2] lavu: add thread message API.

Michael Niedermayer michaelni at gmx.at
Tue Apr 22 16:53:32 CEST 2014


On Mon, Apr 21, 2014 at 12:13:07PM +0200, Nicolas George wrote:
> Le primidi 1er floréal, an CCXXII, Michael Niedermayer a écrit :
> > fails on mingw
> > see:
> > compat/w32pthreads.h:static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
> 
> Indeed. Patch adding a proper return code to the w32pthreads version
> attached, completely untested but quite obvious. And I opened
> https://trac.ffmpeg.org/ticket/3579 for the corresponding problem at the
> call sites.
> 
> Regards,
> 
> -- 
>   Nicolas George

>  w32pthreads.h |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> d0e420604231d7981855a595bccdb5dfdb1c96ed  0001-compat-w32pthreads-add-return-value-to-pthread_cond_.patch
> From 76209c85ce7e17a9ff7e5b37705afa6b62603e1d Mon Sep 17 00:00:00 2001
> From: Nicolas George <george at nsup.org>
> Date: Mon, 21 Apr 2014 11:14:22 +0200
> Subject: [PATCH] compat/w32pthreads: add return value to pthread_cond_init().
> 
> 
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  compat/w32pthreads.h |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
> index 7b51c25..916750f 100644
> --- a/compat/w32pthreads.h
> +++ b/compat/w32pthreads.h
> @@ -134,28 +134,29 @@ typedef struct  win32_cond_t {
>      volatile int is_broadcast;
>  } win32_cond_t;
>  
> -static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
> +static int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
>  {
>      win32_cond_t *win32_cond = NULL;
>      if (cond_init) {
>          cond_init(cond);
> -        return;
> +        return 0;
>      }
>  
>      /* non native condition variables */
>      win32_cond = av_mallocz(sizeof(win32_cond_t));
>      if (!win32_cond)
> -        return;
> +        return AVERROR(ENOMEM);
>      cond->ptr = win32_cond;
>      win32_cond->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
>      if (!win32_cond->semaphore)
> -        return;
> +        return AVERROR_EXTERNAL;
>      win32_cond->waiters_done = CreateEvent(NULL, TRUE, FALSE, NULL);
>      if (!win32_cond->waiters_done)
> -        return;
> +        return AVERROR_EXTERNAL;

i dont think these error codes can be correct for a posix function


>  
>      pthread_mutex_init(&win32_cond->mtx_waiter_count, NULL);
>      pthread_mutex_init(&win32_cond->mtx_broadcast, NULL);
> +    return 0;
>  }
>  
>  static void pthread_cond_destroy(pthread_cond_t *cond)
> -- 
> 1.7.10.4
> 




> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140422/3ac806b3/attachment.asc>


More information about the ffmpeg-devel mailing list