[FFmpeg-devel] [RFC] Removing non-pthreads support

Ramiro Polla ramiro.polla
Thu Apr 22 00:14:28 CEST 2010


On Wed, Apr 21, 2010 at 4:57 PM, Gianluigi Tiesi <mplayer at netfarm.it> wrote:
> #include <stdio.h>
> #include <winsock2.h>
>
> int main(void)
> {
> ? ?DWORD idx = TlsAlloc();
> ? ?TlsSetValue(idx, NULL);
> ? ?WSASetLastError(4);
> ? ?printf("%d\n", WSAGetLastError());
> ? ?TlsGetValue(idx);
> ? ?printf("%d\n", WSAGetLastError());
> }

#include <windows.h>
#include <winsock.h>

#include <stdio.h>

static void print_errors(void)
{
    printf("LastError    %x\n", (int) GetLastError());
    printf("WSALastError %x\n",    WSAGetLastError());
}

int main(void)
{
    DWORD idx = TlsAlloc();
    DWORD lastError;

    printf("WSASetLastError(WSAEHOSTUNREACH)\n");
    WSASetLastError(WSAEHOSTUNREACH);

    print_errors();

    printf("SetLastError(WSAENOTEMPTY)\n");
    SetLastError(WSAENOTEMPTY);

    print_errors();

    lastError = GetLastError();

    TlsGetValue(idx);

    printf("TlsGetValue()\n");

    print_errors();

    printf("SetLastError(lastError)\n");
    SetLastError(lastError);

    print_errors();

    return 0;
}

============output
WSASetLastError(WSAEHOSTUNREACH)
LastError    2751
WSALastError 2751
SetLastError(WSAENOTEMPTY)
LastError    2752
WSALastError 2752
TlsGetValue()
LastError    0
WSALastError 0
SetLastError(lastError)
LastError    2752
WSALastError 2752

It seems SetLastError() was enough...



More information about the ffmpeg-devel mailing list