[vlc-devel] [PATCH] file extension manager (fixed patch)
sashipa.ben at gmail.com
Fri Feb 20 19:39:15 CET 2009
> If you want to be pedantic...
> size_t is defined as the return type of the sizeof() operator, and is hence
> the natural type for (unsigned) array item index. int is defined as at least
> 16-bits. This is wrong.
I was more pratical than pedantic and I see no contradiction. You can
easily imagine memory models where size_t is not the best possible
index for small loop. Thus int is not neccessary the best either but
as it is used by tonnes of program (I won't explain bit to gram
conversion :P) pre or post size_t standardisation so compilers have to
deals with it.
But as I don't care much I will change it to size_t or remove index
and use pointer increments instead.
>> But it's your call but i'm pretty sure most loop in VLC code use int index.
> Old code does, especially due to the table macros. Most newer code uses
>> > We can have multiple instances in a single process, in the same or in
>> > different thread.
>> Multiple instances of the core ?
> We can have multiple instances created from the same thread as well as
> different threads of the same process.
>> I mean there is necessary a part of the code that initialise things
>> before the program forks into thread or process.
> Only on Windows. There we have the DLL entry point in src/misc/threads.c.
>> If it is a process, I don't care. Each have to initialise its
>> extension pool by calling fileext_init() or used an already initialised one
>> that became two of them after the fork.
> Actually, LibVLC cannot live through fork().
>> Only thread trigger race condition so I have to be sure that fileext_Init()
>> is called before any thread that might call fileext public function is
>> created. I thought the part of the code I have added my init call was
>> matching this condition.
> That place is called before the running LibVLC instance creates threads. But
> we can make no assumption about the caller of LibVLC, or other LibVLC
>> If not please tell me where I have to do put it.
Ok if I understood well you mean I can't use static data (except for const) ?
More information about the vlc-devel