[x264-devel] Re: bug in commit 607

Loren Merritt lorenm at u.washington.edu
Sun Dec 17 03:31:57 CET 2006


On Sat, 16 Dec 2006, Måns Rullgård wrote:
>
> The problem is with the pthread stuff at line 48 and following in
> common/common.h, specifically the #define pthread_t int and similar
> lines.  This whole chunk looks very dodgy to me.  Redefining system
> symbols is never a good idea.
>
> Loren, what's the deal with this?  What's the purpose of the
> USE_CONDITION_VAR thing, and why is it only defined on windows?

On linux, we don't need any thread synchronization primitives.
   while(!*foo) usleep(100);
is faster (though not by much. it wouldn't kill performance if we had to 
enable condition variables on linux too).

But on windows, that is very slow and can even hang. win32's own 
WaitForSingleObject was also slow, though more stable.

> Instead of #defining pthread_t and friends, typedefing x264_thread_t
> etc depending on the system should be safer.

Yes, that's an acceptable alternative.

--Loren Merritt


More information about the x264-devel mailing list