[x264-devel] [PATCH] Only init mutexes if threads are being used

Loren Merritt lorenm at u.washington.edu
Sun Apr 27 13:18:59 CEST 2008


On Thu, 24 Apr 2008, Ramiro Polla wrote:

> Attached patch makes x264 only init mutexes if threads are being used. That 
> makes all pthread_ calls depend on threads being actually used at run-time. 
> Another commit is needed for the indentation afterwards.
>
> A problem that can arise is from programs that use static pthreads-win32 but 
> do not call the initialization code it requires. Currently, it would always 
> initialize the mutexes (even if they're not used), and crash the program that 
> did not properly initialize pthreads-win32, even if no threads were asked for 
> at run-time. With attached patch, if a program forgets to properly initialize 
> pthreads-win32, the user can still get away from the crash with not using 
> threads at run-time.

If pthreads-win32 can be fixed to not require initialization, do that 
instead. If the authors of pthreads-win32 choose not to do that, then 
whatever reason they give might also convince me to accept this patch.

--Loren Merritt


More information about the x264-devel mailing list