multithreading


i want to create a program where i spawn 4 threads and loop through a folder and scan a file for a regex expression. whenever the regex expression is found the number of matches goes up by 1.

how could i create a thread, then later when the function is called assign it a particular thread to do the task ? all the examples i came across create a thread and then immediately execute the function.

for instance if i have 10 files in the folder and i want a different thread out of the 4 to do the task for finding the number of matches, how can i assign a thread out of the 4 while i am looping through all the files ?
closed account (SECMoG1T)
if i understood your qst correctly you need to implement a simple thread pool , post the files as you find em into a task queue , let the thread pool handle the rest
Topic archived. No new replies allowed.