Very infrequent ThreadPool Jobs


#1

I have a ThreadPool running, but I’d like to add in a job that only runs very infrequently, say every couple of seconds, while all the other jobs are running very quickly. Of course, I can just start the job, test the time and keep it around, but is that very inefficient i.e. it’s preventing the threadpool ever resting, even if no other jobs are around.

I could roll off a thread, but the job is already there and is the correct thread (OpenGL contexts, oh my).

The other approach seems to be to run another thread, task job, whatever and start a job regularly? Or override the ThreadPool class?

Bruce


#2

You could use a Timer which adds the job to the pool every couple of seconds?