[vdr] Thread start functions and external C linkage (VDR starts
it's threads "incorrectly")
Sascha Volkenandt (ML)
lists at magoa.net
Sun Feb 12 19:00:57 CET 2006
Klaus Schmidinger wrote:
> This would allow anybody to do
>
> cThread t;
> StartThread(&t);
>
> which I don't think would be a good thing to do.
>
> Any ideas how to prevent this from happening?
It's perfectly okay to declare StartThread
extern "C" static void *StartThread(cThread *Thread);
within thread.c so it isn't visible outside the object thread.o. Such an
invalid use would be caught by the (dynamic, in case of plugins) linker.
With gcc 4.0 fulfilling the current standard the friend declaration
isn't even a valid implicit forward declaration anymore, so a misuse of
StartThread would even result in a compile time error then.
Greetings,
Sascha Volkenandt
More information about the vdr
mailing list