But the problem is just don't know how to put this work thread split into multiple child threads to execute, orderly and stable speed, bosses, please grant instruction ! Best can detailed say next architecture how organization
The following is a simplified code:
UINT CMeasureDlg: : AutoMeasureThread (LPVOID pPAR)//worker thread
{
for(int i=0; I & lt; 5; I++)//I need the number of data; * * * * * * * * * * *
{
The switch (I)
{
//read the first line parameters;
Case 0: GetPrivateProfileString (_T (", Line1-1 "), _T (" num_measures_1-1 "), _T (" 50 "), and STR. GetBuffer (255), 255, PathStr);
M_Num_Measures_1=_ttoi (STR);
, Line1 GetPrivateProfileString (_T (" 1 "), _T (" measure_length1_1-1 "), _T (" 30 "), and STR. GetBuffer (255), 255, PathStr);
M_Measure_Length1_1=_ttoi (STR);
break;
//read 2 line parameters;
Case 1: GetPrivateProfileString (_T (", Line1-1 "), _T (" num_measures_1-1 "), _T (" 50 "), and STR. GetBuffer (255), 255, PathStr);
M_Num_Measures_1=_ttoi (STR);
, Line1 GetPrivateProfileString (_T (" 1 "), _T (" measure_length1_1-1 "), _T (" 30 "), and STR. GetBuffer (255), 255, PathStr);
M_Measure_Length1_1=_ttoi (STR);
break;
//read line 3 parameters;
Case 2: GetPrivateProfileString (_T (", Line1-1 "), _T (" num_measures_1-1 "), _T (" 50 "), and STR. GetBuffer (255), 255, PathStr);
M_Num_Measures_1=_ttoi (STR);
, Line1 GetPrivateProfileString (_T (" 1 "), _T (" measure_length1_1-1 "), _T (" 30 "), and STR. GetBuffer (255), 255, PathStr);
M_Measure_Length1_1=_ttoi (STR);
break;
Case 3:
break;
//read the fifth line parameters;
Case 4: GetPrivateProfileString (_T (", Line1-1 "), _T (" num_measures_1-1 "), _T (" 50 "), and STR. GetBuffer (255), 255, PathStr);
M_Num_Measures_1=_ttoi (STR);
, Line1 GetPrivateProfileString (_T (" 1 "), _T (" measure_length1_1-1 "), _T (" 30 "), and STR. GetBuffer (255), 255, PathStr);
M_Measure_Length1_1=_ttoi (STR);
break;
Default:
break;
}
Int data=https://bbs.csdn.net/topics/Function (m_Num_Measures_1, m_Measure_Length1_1)//the parameters in this substitution function
Data_SUM [I]=data;//the data merging together;
}
Data_SUM [I]//in the end will be according to the output to the total list control display;
}
It is online to see the practice of others, can choose how many threads to open operation, don't know is how to realize simultaneous multi-threading;
CodePudding user response:
Fear of capture despise not clear, I knocked over the code to theCodePudding user response:
Depends on your specific implementation of the algorithm to design how to split the work,Related papers should be a lot of, see more?
CodePudding user response:
Can use the task manager to see program of CPU usage, if the occupancy rate is low estimate GetPrivateProfileString is too slowCodePudding user response:
Obviously is slow in IO, the CPU is not the bottleneck, GetPrivateProfileString read each call to the hard disk and a linear search, if the file is very big, of course, is slow, the file read into memory first, in the memory to find again,Another INI file is not designed to store large amounts of data, main purpose is to save the configuration parameters of the INI file and a small amount of information,
A lot of structured data had better use XML/SQLITE store, query efficiency is high
CodePudding user response:
to learn