Changeset 284


Ignore:
Timestamp:
08/22/10 09:05:21 (18 months ago)
Author:
mickem
Message:

A few unix related twekas

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/settings/settings_core.hpp

    r283 r284  
    3636 
    3737 
    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   }; 
    6638  class settings_exception { 
    6739    std::wstring error_; 
  • trunk/service/settings_client.hpp

    r283 r284  
    112112      } catch (settings::settings_exception e) { 
    113113        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())); 
    114116      } catch (...) { 
    115117        error_msg(_T("FATAL ERROR IN SETTINGS SUBSYTEM")); 
Note: See TracChangeset for help on using the changeset viewer.