#include <wx/utils.h>
#include <creaImageIOSystem.h>
+
namespace creaImageIO
{
vtkImageData* Read(const std::string& filename);
+ struct deleter
+ {
+ void operator()(ThreadedImageReader* p)
+ {
+ p->Delete();
+ }
+ };
+ friend struct deleter;
+
private:
ImageReader mReader;
MultiThreadImageReader* mMultiThreadImageReader;
};
+
+
//=====================================================================
// Create the threads
for (int i=0; i<number_of_threads; i++)
{
- //ThreadedImageReader* t = new ThreadedImageReader(this);
- boost::shared_ptr<ThreadedImageReader> t(new ThreadedImageReader(this));
+ //ThreadedImageReader* t = new ThreadedImageReader(this);
+ boost::shared_ptr<ThreadedImageReader> t(new ThreadedImageReader(this), ThreadedImageReader::deleter());
mThreadedImageReaderList.push_back(t);
std::cout << " ===> Thread "<<i
<<" successfully added"<< std::endl;
<<" successfully stopped"<< std::endl;
if((*i)->IsAlive())
{
- (*i)->Delete();
+ //(*i)->Delete();
}
}
- mThreadedImageReaderList.clear();
+ // mThreadedImageReaderList.clear();
// Wait a little to be sure that all threads have stopped
// A better way to do this ?
// wxMilliSleep(1000);