I’ve recently noticed that my app that creates worker thread for each installed GPU (with subsequent context creation/destruction inside the thread) eats more and more system handles (working under WinXP).
These are the steps the application performs hundreds of times:
I thought that it is also possible to create the context each time the thread is started as well to destroy the context each time the thread is finished, looks like I was wrong.
Am I right that it is actually necessary to create a number of contexts (one per GPU) once the application is started and then assign them to worker threads ?
as far as i know you can do what you are saying, create a thread create a context do work and then destroy the context and the thread. But why do all that ? why not create all the worker threads and contexts when the program goes up. and then keep them idle until you have work to give them ? Any ways you have to make sure that you destroy the context from the correct thread.
It is easier for me (due to application architecture reasons) to create and destroy worker threads rather then managing them (keeping them idle, resuming them when needed e t c). So I decided to create the context for each worker thread from withing that thread itself and then to destroy the context when the thread is about to finish.