aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-09-20 08:19:23 +0000
committerlloyd <[email protected]>2006-09-20 08:19:23 +0000
commitde37a33633c96366216644a898b8c23fcd0f29a4 (patch)
treefbe32e081ec5a0f243b19344b6909a22d031e1d3
parent7dc1f8c8ce6b1f959c4f90cb99661b76eec60bbb (diff)
The public add_engine API now always places the new engine at the front
of the list. The only time when the other behavior was desired was inside the load() function, which now simply appends to the engines vector itself.
-rw-r--r--include/libstate.h2
-rw-r--r--src/libstate.cpp17
2 files changed, 9 insertions, 10 deletions
diff --git a/include/libstate.h b/include/libstate.h
index ece05609a..610f730e8 100644
--- a/include/libstate.h
+++ b/include/libstate.h
@@ -48,7 +48,7 @@ class Library_State
class Config& config() const;
- void add_engine(class Engine*, bool);
+ void add_engine(class Engine*);
class Mutex* get_mutex() const;
class Mutex* get_named_mutex(const std::string&);
diff --git a/src/libstate.cpp b/src/libstate.cpp
index a782f4c60..c9db23be8 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -242,14 +242,10 @@ Engine* Library_State::get_engine_n(u32bit n) const
/*************************************************
* Add a new engine to the list *
*************************************************/
-void Library_State::add_engine(Engine* engine, bool in_front)
+void Library_State::add_engine(Engine* engine)
{
Named_Mutex_Holder lock("engine");
-
- if(in_front)
- engines.insert(engines.begin(), engine);
- else
- engines.push_back(engine);
+ engines.insert(engines.begin(), engine);
}
/*************************************************
@@ -320,9 +316,12 @@ void Library_State::load(Modules& modules)
set_default_allocator(modules.default_allocator());
- std::vector<Engine*> engines = modules.engines();
- for(u32bit j = 0; j != engines.size(); ++j)
- add_engine(engines[j], false);
+ std::vector<Engine*> mod_engines = modules.engines();
+ for(u32bit j = 0; j != mod_engines.size(); ++j)
+ {
+ Named_Mutex_Holder lock("engine");
+ engines.push_back(mod_engines[j]);
+ }
std::vector<EntropySource*> sources = modules.entropy_sources();
for(u32bit j = 0; j != sources.size(); ++j)