2010년 5월 20일 목요일

C++에서 멤버함수를 스레드로 이용시

#pragma comment (lib, "ws2_32.lib")
#include <stdio.h>
#include
#include
#include // _beginthreadex 함수 참조
#include


class a
{
    public:
    static UINT WINAPI aaa(void *arg);
};


UINT WINAPI a::aaa(void *arg)
{
    printf("[%s:%d]\n", __FILE__, __LINE__);

    return 0;
}


int main()
{
    HANDLE hThread;
    hThread = (HANDLE)_beginthreadex(NULL, 0, a::aaa, NULL, 0, NULL);
    WaitForSingleObject(hThread, 100);

    return 0;
}

이건...

어케 사용하는 거지? ^^