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:
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.