CreateThread与_beginthreadex这个两个函数有啥区别啊
下面这段代码为啥编译能通过
#include<windows.h>
#include<stdio.h>
#include<process.h>
long i=0;
HANDLE g_s;
unsigned __stdcall ThreadProc1 (
  LPVOID lpParameter   // thread data
)
{
    WaitForSingleObject(g_s,INFINITE);
    i++;
    printf("线程1->%d\n",i);
    return 0;    
}
unsigned __stdcall ThreadProc2 (
  LPVOID lpParameter   // thread data
)
{
    WaitForSingleObject(g_s,INFINITE);
    i++;
    printf("线程2->%d\n",i);
    return 0;    
}
int main()
{
    HANDLE handle1,handle2;
    g_s=CreateEvent(NULL,TRUE,FALSE,NULL);
handle1=_beginthreadex(NULL,0,ThreadProc1,0,0,0);
    handle2=_beginthreadex(NULL,0,ThreadProc2,0,0,0);
    SetEvent(g_s);
    WaitForSingleObject(handle1,INFINITE);
    CloseHandle(handle1);
    CloseHandle(handle2);
    printf("%d",i);
    ResetEvent(g_s);
    return 0;
}
而这段却通不过
#include<stdio.h>
long i=0;
HANDLE g_s;
DWORD WINAPI ThreadProc1(
  LPVOID lpParameter   // thread data
)
{
WaitForSingleObject(g_s,INFINITE);
i++;
    printf("线程1->%d\n",i);
return 0;
}
DWORD WINAPI ThreadProc2(
  LPVOID lpParameter   // thread data
)
{
WaitForSingleObject(g_s,INFINITE);
i++;
    printf("线程2->%d\n",i);
return 0;
}
int main()
{
HANDLE handle1,handle2;
g_s=CreateEvent(NULL,TRUE,FALSE,NULL);
handle1=CreateThread(NULL,NULL,ThreadProc1,NULL,NULL,NULL);
handle2=CreateThread(NULL,NULL,ThreadProc2,NULL,NULL,NULL);
SetEvent(g_s);
printf("%d\n",i);
CloseHandle(handle1);
    CloseHandle(handle2);
    ResetEvent(g_s);
return 0;
}