diff options
author | lloyd <[email protected]> | 2006-06-25 12:04:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-25 12:04:55 +0000 |
commit | eae468a0bbbc0477510a64e0eb19a872b0aaefac (patch) | |
tree | bb715166d14332421c8300837b832b0a520776a7 /src/libstate.cpp | |
parent | ec83a0349f62f98765b93b3191c2b70e2aab5939 (diff) |
Add a set_timer method to Library_State, and rearrange the order
of initialization in the constructor.
Diffstat (limited to 'src/libstate.cpp')
-rw-r--r-- | src/libstate.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/libstate.cpp b/src/libstate.cpp index 98ccb5e7c..a2a3bbe9a 100644 --- a/src/libstate.cpp +++ b/src/libstate.cpp @@ -127,6 +127,15 @@ void Library_State::add_allocator(Allocator* allocator) } /************************************************* +* Set the high resolution clock implementation * +*************************************************/ +void Library_State::set_timer(Timer* new_timer) + { + delete timer; + timer = new_timer; + } + +/************************************************* * Read a high resolution clock * *************************************************/ u64bit Library_State::system_clock() const @@ -319,15 +328,13 @@ X509_GlobalState& Library_State::x509_state() /************************************************* * Library_State Constructor * *************************************************/ -Library_State::Library_State(Mutex_Factory* mutex_factory, Timer* timer) +Library_State::Library_State(Mutex_Factory* mutex_factory) { if(!mutex_factory) mutex_factory = new Mutex_Factory; - if(!timer) - timer = new Timer; this->mutex_factory = mutex_factory; - this->timer = timer; + this->timer = new Timer(); this->transcoder = 0; locks["settings"] = get_mutex(); @@ -352,6 +359,7 @@ Library_State::~Library_State() delete entropy_sources[j]; delete rng; + delete timer; for(u32bit j = 0; j != engines.size(); ++j) delete engines[j]; @@ -364,12 +372,11 @@ Library_State::~Library_State() delete j->second; } - delete mutex_factory; - delete timer; - for(std::map<std::string, Mutex*>::iterator j = locks.begin(); j != locks.end(); ++j) delete j->second; + + delete mutex_factory; } } |