aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-07 19:50:57 +0000
committerlloyd <[email protected]>2006-07-07 19:50:57 +0000
commit3d4734a8aad130f36cf61a39eb8dfcca0eccb816 (patch)
tree0b4fea23435a503b590efddb3daca677b4738867
parentc332c81d0b90ba0db7d628eff0b77a381a8bf765 (diff)
Make Mutex_Factory an abstract class, move the creation of the no-op
Default_Mutex to the new Default_Mutex_Factory
-rw-r--r--include/mutex.h11
-rw-r--r--src/init_def.cpp6
-rw-r--r--src/mutex.cpp2
3 files changed, 16 insertions, 3 deletions
diff --git a/include/mutex.h b/include/mutex.h
index 48d1ea637..2d716014f 100644
--- a/include/mutex.h
+++ b/include/mutex.h
@@ -27,11 +27,20 @@ class Mutex
class Mutex_Factory
{
public:
- virtual Mutex* make();
+ virtual Mutex* make() = 0;
virtual ~Mutex_Factory() {}
};
/*************************************************
+* Default Mutex Factory *
+*************************************************/
+class Default_Mutex_Factory : public Mutex_Factory
+ {
+ public:
+ Mutex* make();
+ };
+
+/*************************************************
* Mutex Holding Class *
*************************************************/
class Mutex_Holder
diff --git a/src/init_def.cpp b/src/init_def.cpp
index 21cc07aaa..05631127c 100644
--- a/src/init_def.cpp
+++ b/src/init_def.cpp
@@ -41,7 +41,11 @@ void initialize(const InitializerOptions& args)
set_global_state(
new Library_State(
- args.thread_safe() ? modules.mutex_factory() : new Mutex_Factory));
+ args.thread_safe() ?
+ modules.mutex_factory() :
+ new Default_Mutex_Factory
+ )
+ );
global_state().config().load_defaults();
if(args.config_file() != "")
diff --git a/src/mutex.cpp b/src/mutex.cpp
index a6d18a44c..89cbacbb1 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -46,7 +46,7 @@ Named_Mutex_Holder::~Named_Mutex_Holder()
/*************************************************
* Default Mutex Factory *
*************************************************/
-Mutex* Mutex_Factory::make()
+Mutex* Default_Mutex_Factory::make()
{
class Default_Mutex : public Mutex
{