原子操作函数的问题,求大神指教
程序代码:
#include <iostream> #include <process.h> #include <stdlib.h> #include <stdio.h> #include <windows.h> using namespace std; volatile long g_nLoginCount; unsigned int _stdcall Fun(void *pPM); const int THREAD_NUM=50; unsigned int _stdcall Fun(void *pPM) { Sleep(1000); //g_nLoginCount++; InterLockedIncrement((LPLONG)&g_nLoginCount); Sleep(50); return 0; } int main() { int num=20; while(num--) { g_nLoginCount=0; HANDLE handle[THREAD_NUM]; for(int i=0;i<THREAD_NUM;i++) { handle[i]=(HANDLE)_beginthreadex(NULL,0,Fun,NULL,0,NULL); } WaitForMultipleObjects(THREAD_NUM,handle,TRUE,INFINITE); //printf("有%d个用户登录后记录结果是%dn",THREAD_NUM,g_nLoginCount); cout<<"有"<<THREAD_NUM<<"个用户登录后记录结果是"<<g_nLoginCount<<endl; } return 0; }运行结果显示error C3861: “InterLockedIncrement”: 找不到标识符,求大神指教