ThreadPool Request


#1

Hi Jules

Can you consider adding this callback to your todo queue:
ThreadPool::JobFinished(ThreadPoolJob *job)

Or a more general one:
ThreadPool::JobStatusChanged(ThreadPoolJob *job)

I’m currently using a workaround with the ThreadPool::waitForJobToFinish()

Thanks


#2

I can’t add that - the ThreadPool isn’t designed to have any virtual methods.

And you already have a place to put code that should be run when a job finishes: put it at the end of the job itself!


#3

Yes but there’s all the abnormal cases like shouldExit() and such, and adding it to the jobs will mean another inheritance to the ThreadPoolJob.
I just thought it will be more smoothly that way.


#4

It’s trivial to just add whatever call you need at the end of your runJob() method, and that’d certainly be much cleaner than changing the ThreadPool class to be inheritable and then creating subclasses of it, just to find out when a job has finished!


#5

Got it.
Thanks Jules