aWriter->Delete();\r
myImageData->Delete();\r
\r
- if(MYDEBUG) cout<<"VVTK_ImageWriter::run() - this = "<<this<<endl;\r
+ if(MYDEBUG) cout<<"VVTK_ImageWriter::run "<<\r
+ "- this = "<<this<<\r
+ "; total = "<<mySemaphore->total()<<\r
+ "; available = "<<mySemaphore->available()<<endl;\r
*mySemaphore -= 1;\r
}\r
\r
VVTK_ImageWriterMgr\r
::VVTK_ImageWriterMgr()\r
{\r
- int aMax = std::numeric_limits<int>::max();\r
+ int aMax = std::numeric_limits<int>::max() / 2;\r
mySemaphore = new QSemaphore(aMax);\r
*mySemaphore += aMax;\r
+ if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<<\r
+ "- total = "<<mySemaphore->total()<<\r
+ "; available = "<<mySemaphore->available()<<endl;\r
}\r
\r
\r
VVTK_ImageWriterMgr\r
::Stop()\r
{\r
- if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop - *mySemaphore -= "<<myThreads.size()<<endl;\r
+ if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop "<<\r
+ "- total = "<<mySemaphore->total()<<\r
+ "; available = "<<mySemaphore->available()<<endl;\r
+ if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop - *mySemaphore += "<<myThreads.size()<<endl;\r
*mySemaphore += myThreads.size();\r
\r
- for(size_t anId = 0, anEnd = myThreads.size(); anId < anEnd; anId++)\r
- delete myThreads[anId];\r
+ for(size_t anId = 0, anEnd = myThreads.size(); anId < anEnd; anId++){\r
+ VVTK_ImageWriter* anImageWriter = myThreads[anId];\r
+ while(!anImageWriter->finished())\r
+ sleep(100);\r
+ delete anImageWriter;\r
+ }\r
\r
myThreads.clear();\r
}\r