comparison transform/TransformFactory.cpp @ 574:2d551c765d51

* thread tidying fix, etc
author Chris Cannam
date Mon, 16 Mar 2009 13:56:11 +0000
parents 1b8c748fd7ea
children 2ba202c5be8d
comparison
equal deleted inserted replaced
573:bdc9bb371a9f 574:2d551c765d51
47 TransformFactory::getInstance() 47 TransformFactory::getInstance()
48 { 48 {
49 return m_instance; 49 return m_instance;
50 } 50 }
51 51
52 void
53 TransformFactory::deleteInstance()
54 {
55 std::cerr << "TransformFactory::deleteInstance called" << std::endl;
56 delete m_instance;
57 m_instance = 0;
58 }
59
52 TransformFactory::TransformFactory() : 60 TransformFactory::TransformFactory() :
53 m_transformsPopulated(false), 61 m_transformsPopulated(false),
54 m_uninstalledTransformsPopulated(false), 62 m_uninstalledTransformsPopulated(false),
55 m_thread(0) 63 m_thread(0),
64 m_exiting(false)
56 { 65 {
57 } 66 }
58 67
59 TransformFactory::~TransformFactory() 68 TransformFactory::~TransformFactory()
60 { 69 {
70 m_exiting = true;
71 if (m_thread) {
72 std::cerr << "TransformFactory::~TransformFactory: waiting on thread" << std::endl;
73 m_thread->wait();
74 delete m_thread;
75 }
61 } 76 }
62 77
63 void 78 void
64 TransformFactory::startPopulationThread() 79 TransformFactory::startPopulationThread()
65 { 80 {
692 td.units = ""; 707 td.units = "";
693 td.configurable = false; 708 td.configurable = false;
694 709
695 m_uninstalledTransforms[tid] = td; 710 m_uninstalledTransforms[tid] = td;
696 } 711 }
712
713 if (m_exiting) break;
697 } 714 }
698 715
699 m_uninstalledTransformsPopulated = true; 716 m_uninstalledTransformsPopulated = true;
700 717
701 std::cerr << "populateUninstalledTransforms exiting" << std::endl; 718 std::cerr << "populateUninstalledTransforms exiting" << std::endl;