Changeset 284
- Timestamp:
- 08/22/10 09:05:21 (18 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/settings/settings_core.hpp (modified) (1 diff)
-
service/settings_client.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/settings/settings_core.hpp
r283 r284 36 36 37 37 38 template<class T>39 struct instance_ptr_helper {40 boost::shared_ptr<T> ptr_;41 boost::unique_lock<boost::timed_mutex> *mutex_;42 instance_ptr_helper(boost::shared_ptr<T> ptr, boost::timed_mutex &mutex, int timeout) : ptr_(ptr), mutex_(NULL) {43 mutex_ = new boost::unique_lock<boost::timed_mutex>(mutex, boost::get_system_time() + boost::posix_time::seconds(timeout));44 std::wcout << _T("creating (safe)...") << std::endl;45 if (!mutex_->owns_lock())46 throw settings_exception(_T("Failed to get mutex, cant get settings instance"));47 }48 instance_ptr_helper(boost::shared_ptr<T> ptr) : ptr_(ptr) {49 std::wcout << _T("creating (unsafe)...") << std::endl;50 delete mutex_;51 }52 ~instance_ptr_helper() {53 std::wcout << _T("destroying...") << std::endl;54 }55 boost::shared_ptr<T> operator* () const {56 return ptr_;57 }58 59 boost::shared_ptr<T> operator-> () const {60 return ptr_;61 }62 bool operator! () const {63 return !ptr_;64 }65 };66 38 class settings_exception { 67 39 std::wstring error_; -
trunk/service/settings_client.hpp
r283 r284 112 112 } catch (settings::settings_exception e) { 113 113 error_msg(_T("Failed to initialize settings: ") + e.getError()); 114 } catch (std::exception &e) { 115 error_msg(_T("Failed to initialize settings: ") + to_wstring(e.what())); 114 116 } catch (...) { 115 117 error_msg(_T("FATAL ERROR IN SETTINGS SUBSYTEM"));
Note: See TracChangeset
for help on using the changeset viewer.







