[FFmpeg-devel] [PATCH] pthread detection on mingw + static pthread
Måns Rullgård
mans
Wed Apr 23 15:07:50 CEST 2008
Gianluigi Tiesi wrote:
> On Tue, Apr 22, 2008 at 10:16:35PM +0100, M?ns Rullg?rd wrote:
>> > + elif check_func pthread_create -DPTW32_STATIC_LIB -lpthreadGC2 -lws2_32;
>> then
>>
>> The -D flag in that line has no effect, and can thus be removed.
>>
>> > + add_cflags -DPTW32_STATIC_LIB
> hmm I've seen the compile options in config.err and it's used
I said it has no effect, even though it is passed to the compiler.
> anyway is needed to work when static linking
Why is this?
>> Is this preprocessor define required by the library, or was it
>> something you invented for use in ffmpeg.c?
>>
>> > + add_extralibs -lpthreadGC2 -lws2_32
>> > elif ! check_lib pthread.h pthread_create -lpthread; then
>> > die "ERROR: can't find pthreads library"
>> > fi
>> > @@ -1629,7 +1634,7 @@
>> > enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
>> > enabled libtheora && require libtheora theora/theora.h theora_info_init
>> -ltheora -logg
>> > enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init
>> -lvorbisenc -lvorbis -logg
>> > -enabled libx264 && require x264 x264.h x264_encoder_open -lx264 -lm
>> > +enabled libx264 && require2 x264 "stdint.h x264.h" x264_encoder_open -lx264
>> -lm
>>
>> Not necessary.
> libx264 requires stdint.h
Yes, but checking whether x264.h exists doesn't need it.
> also if compiled with pthreads static it requires -lpthreadGC2 -lws2_32
> or detection will fail
That is an unrelated issue.
>> > +}
>> > +#endif
>> > +
>> > int main(int argc, char **argv)
>> > {
>> > int i;
>> > int64_t ti;
>> >
>> > +#ifdef PTW32_STATIC_LIB
>> > + pthread_win32_process_attach_np();
>> > + pthread_win32_thread_attach_np();
>> > + atexit(detach_ptw32);
>> > +#endif
>>
>> What if the process is terminated without calling exit()? I also
>> don't like the ifdef mess. Systems that require this don't deserve
>> threads, IMNSHO.
> if a process does not call exit it's because is crashed or called
> abort(), I don't think calling detach is needed here
> the ifdef is the only way, x264.c does the same thing without
> atexit, that perhaps can be avoided if the code does not calls exit()
> the problem with abnormal termination will stay
It's still ugly, and I still don't think we need to support such
configurations. We don't support VMS either.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list