Looks like if you use tasks in one thread and destroyed it after, than next time if you use tasks from other thread you get exception from libiomp5md.dll Here is code that reproduces it on my system (Microsoft Windows [Version 6.1.7601],Intel C++ Compiler XE for applications running on IA-32, Version 12.1.0.233 Build 20110811,Microsoft Visual Studio 2010Version 10.0.40219.1 SP1Rel)
#include
#include
int fib ( int n )
{
int x,y;
if ( n < 2 )
return n;
#pragma omp task shared(x)
x = fib(n-1);
#pragma omp task shared(y)
y = fib(n-2);
#pragma omp taskwait
return x+y;
}
void fib_fn(int n)
{
int res;
#pragma omp parallel
{
#pragma omp single
res = fib(n);
}
std::cout << res << std::endl;
}
int main()
{
fib_fn(10);
for(int i = 0; i < 10; i++)
{
std::thread th(fib_fn,10);
th.join();
}
return 0;
}


