I have my own C ++ module for python that provides functions, some of which use TBB (tbb21_015oss) to speed up processing.
So far I have not had a problem calling a function with TBB acceleration from Python (2.6.2) in a Win32 environment.
But now I have a problem when calling such a function from a Python thread (created using a class threading.Thread) - when calling the same function from the main thread, Python works fine.
A function call will cause the application to crash with the following message:
First-chance exception at 0x03522e96 in python.exe:
0xC0000005: Access violation reading location 0x000000c8.
The base address of TBB.dll is 0x03510000, and according to the MSVC 2005 debugger, a crash occurs in the code from TBB "parallel_for.h", apparently in static void start_for::run( const Range& range, const Body& body, const Partitioner& partitioner )execution:
start_for& a = *new(task::allocate_root(context)) start_for(range,body,const_cast<Partitioner&>(partitioner));
It seems that the NULL pointer is dereferenced.
FWIW, TBB :
tbb::task_scheduler_init g_tbbinit(tbb::task_scheduler_init::deferred);
...
g_tbbinit.initialize();
? , TBB , "" ?