[vlc-devel] X264 and multithreading on win32

Andre Weber WeberAndre at gmx.de
Tue Feb 5 19:57:04 CET 2008


Hi,

> Does anybody have an idea of how/where to call this initialization
> functions properly?
give the file ...

/src/misc/win32_specific.c

a chance the function

system_Init( ...)

and

system_End( ... )

sounds promising and may be your friend?
(I'am not sure if this would be right... I'am a "newbee" here...)

I'am searching also for such a location to call some timer initialization for win32,
which must be called for setup and cleanup at application level...


André

(aka Atmo)


----- Original Message ----- 
From: "Benjamin Pracht" <bigben+spam at videolan.org>
To: <vlc-devel at videolan.org>
Sent: Tuesday, February 05, 2008 7:47 PM
Subject: [vlc-devel] X264 and multithreading on win32


> Hi,
>
> I think I have a better idea of the reason why x264 crashes vlc when
> compiled with pthreads-win32 on windows.
>
> When pthreads-win32 is linked statically with an application, this
> application has to call both pthread_win32_process_attach_np and
> pthread_win32_process_attach_np before doing any pthread call. This
> initializes some static data in the library (beurk).
> pthread_win32_process_detach_np and pthread_win32_process_detach_np
> should be called as well when pthreads-win32 is not used. When adding
> these lines in x264.c, before x264-encoder-open, linking the module with
> pthreads-win32 and adding the -DPTW32_STATIC_LIB CFLAG, I'm able to use
> x264 on windows with multithreading enabled.
>
> Now, pthreads-win32 doesn't really check if the initilization function
> has already been called by the application, and doesn't keep any
> refcount (rebeurk). This means that with the previous approach, if the
> application uses the x264 vlc module a second time, the library is going
> to be initialized a second time. Worse, if we add
> pthread_win32_process_detach_np to the encoder close function, we'll end
> up uninitializing the lib while it may still be in use.
>
> Does anybody have an idea of how/where to call this initialization
> functions properly?
>
> -- 
> BigBen
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list