diff --git a/test/STL.h b/test/STL.h index 66b22d1..e300286 100644 --- a/test/STL.h +++ b/test/STL.h @@ -13,14 +13,14 @@ static std::mapBool_STL; struct TimeSTLStruct { - std::string Name; + wchar_t* Name; int Max_Time; int Now_Time; long long Static_Time; HANDLE Thand; }; //构造Time类型容器 -static std::mapTime_STL; +static std::mapTime_STL; //构造intarr类型容器 static std::map>IntArr_STL; diff --git a/test/squirrel.cpp b/test/squirrel.cpp index 6486d25..2884c8f 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -825,17 +825,18 @@ int squirrel::New_STL(uint32_t v) //时间容器线程 void TimeSTL(LPVOID lpParam) { - TimeSTLStruct *pack = (TimeSTLStruct*)lpParam; - Time_STL[pack->Name].Static_Time = (int)GetTickCount64(); - while (true) + TimeSTLStruct *pack = (TimeSTLStruct*)lpParam;//得到传递的包 + Time_STL[pack->Name].Static_Time = (int)GetTickCount64();//设置时间容器的基准时间 + while (true)//线程循环 { - int N_Time = (int)GetTickCount64() - Time_STL[pack->Name].Static_Time; - if (N_Time < Time_STL[pack->Name].Max_Time) + int N_Time = (int)GetTickCount64() - Time_STL[pack->Name].Static_Time;//得到现在的时间 + if (N_Time < Time_STL[pack->Name].Max_Time)//如果还没到 设定新的now时间 { Time_STL[pack->Name].Now_Time = N_Time; } - else + else//如果到了 设定now同步最大时间 { + Time_STL[pack->Name].Now_Time = Time_STL[pack->Name].Max_Time; break; } } @@ -843,14 +844,14 @@ void TimeSTL(LPVOID lpParam) //时间容器 int squirrel::Timer_STL(uint32_t v) { - char* Name; + wchar_t* Name; int MaxTime; int Type; int ParameterNum = SQGetTop(v); if (ParameterNum == 4) { //获取容器名字 - SQGetStringc(v, 2, &Name); + SQGetString(v, 2, &Name); //获取最大值 SQGetInt(v, 3, &MaxTime); //获取容器类型