multithreading - beginner needs help with design/planning report-functionality in C++ Application -


i'm somehow stuck implementing reporting functionailty in log-parser application.

this did far:

i'm writing application reads logfiles , searches strings multiple regular expressions can defined in user-configuration file. every called "stringpipe"-defintion parsed configuration main-process spawns worker thread search single regex. more definitons user creates, more worker threads spawned. main function reads bunch of logstrings , sends workers process strings , on.

now want every single worker thread spawned report information number of matches has found, how long took, did strings , on. these information used export csv, write db , on.

now i'm stuck @ point created class "report". class provides member functions called worker threads make report-class gather infos needed generating report.

for workers (which boost::threads / functors) have create report-object can call reporting functions for.

the problem in design, because when worker-thread finishes job, destroyed , next bunch of strings needs processed new instance of worker functor spawned , needs create new report object.

this problem understanding, because need kind of container every worker can store it's reported infos , global report contains such infos how long whole processing has taken, worker slowest , on.

i need collect these infos together, how can this? everytime worker stops, reports, , starts again, destroy report-object , it's members, infos previous work gone.

how can solve problem or how such thing handled in general?

first, not spawn new thread re searching , such. rather, want pool of threads handle jobs arise.

as far retrieving , processing results go, sounds want futures. basic idea create object hold result of computation, , future keep track of when computation complete. can either wait results complete, or register call-back called when future complete.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -