[FFmpeg-devel] [PATCH] Enable proper IPv6 functions on windows
Ronald S. Bultje
Fri Jan 22 16:50:03 CET 2010
On Fri, Jan 22, 2010 at 10:40 AM, Martin Storsj? <martin at martin.st> wrote:
> On Fri, 22 Jan 2010, Ronald S. Bultje wrote:
>> > + ? ?int (WSAAPI *win_getnameinfo)(const struct sockaddr *sa, socklen_t salen,
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?char *host, DWORD hostlen,
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?char *serv, DWORD servlen, int flags);
>> > + ? ?HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
>> > + ? ?win_getnameinfo = GetProcAddress(ws2mod, "getnameinfo");
>> > + ? ?if (win_getnameinfo)
>> > + ? ? ? ?return win_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
>> Sorry, I didn't follow the discussion very much...
>> Shouldn't the function pointer variable (in all functions) not be
>> static? Now you load it every time which sounds like a huge
>> time-waster to me. Otherwise looks ok to me.
> I guess that would be ok, too. Theoretically, it wouldn't be totally
> thread safe, but for all practical matters I think it would be ok.
How would it not be threadsafe? In the worst case, we store the (same)
function pointer address in that variable twice (or, oh no!!!, even 3
times). However, the value should never be invalid unless the compiler
is on drugs and clears the variable before storing the actual address
More information about the ffmpeg-devel