i'm new to multi threading, while i try to develop an application which processes a file i'm stuck at a point. below is the detailed description. please help.
my application reads a directory and loads all the files into class objects. the File class contains the data of the file along with few operational methods. after loading all[limited by constant] the files into memory i want to execute a method void processFile() for each object. i'm thinking to go to multi threading to improve performance so please tell me a way to achieve this.
my class interface:
class D3v_File{
private:
string* lines;
string fname;
int fileState;
int T_lineCnt;
int C_lineCnt;
static int fileCnt;
public:
D3v_File(const string& f_name);
string next_line();
void load_now();
void process_file();
~D3_File();
};
so in my code some where i have a container
vector < D3v_File > File_Obs;
i want to execute the process_file function of objects in the container File_obs parallel.
suggest me the best approach.
Aucun commentaire:
Enregistrer un commentaire