views:

21

answers:

0

Hi,

I have been using Open MP to speed up an application. However I seem to be having a problem with the creating of additional thread pools. I am compiling on Windows XP using Visual Studio 2005 (Open MP 1.0).

The program is similar to a web server, a request from a client comes in and I spawn a thread (using beginthread), this thread then carries out some work (using Open MP) and returns the results to the client and the thread exists. However the thread pool created by the Open MP code remains.

So when another request comes in, a new thread is spawned, and another Open MP threadpool is created.

As you can imagine this gets expensive quickly.

I know I could maintain the threads spawned with beginthread and reuse them, however the computational work performed by these threads more than justifies the cost of creating them with begin thread. Not to mention cuts out all the work of managing the reuse of threads.

My question is, is there a way to stop Open MP creating a thread pool per thread context? Or is there a way of deleting the thread pool on exit of the thread?

Cheers Rich