aboutsummaryrefslogtreecommitdiffstats
path: root/src/init_def.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-07 19:45:10 +0000
committerlloyd <[email protected]>2006-07-07 19:45:10 +0000
commitd45622ea8c8389f851b8826f8b47428b100bb0d2 (patch)
tree16db66b97ff99bb6929b458b347ad1643e9f2a5e /src/init_def.cpp
parent58083678efb84913d8daeab20e37609966308826 (diff)
Have Library_State's constructor thrown an exception if the
mutex_factory argument is NULL. Have Init::initialize() pass either a new Mutex_Factory (the default no-op version), or the result of modules.mutex_factory(), depending on the value of args.thread_safe()
Diffstat (limited to 'src/init_def.cpp')
-rw-r--r--src/init_def.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/init_def.cpp b/src/init_def.cpp
index 6575f61bb..21cc07aaa 100644
--- a/src/init_def.cpp
+++ b/src/init_def.cpp
@@ -39,16 +39,10 @@ void initialize(const InitializerOptions& args)
{
Builtin_Modules modules(args.secure_memory());
- Mutex_Factory* mutex_factory = 0;
+ set_global_state(
+ new Library_State(
+ args.thread_safe() ? modules.mutex_factory() : new Mutex_Factory));
- if(args.thread_safe())
- {
- mutex_factory = modules.mutex_factory();
- if(!mutex_factory)
- throw Exception("LibraryInitializer: thread safety impossible");
- }
-
- set_global_state(new Library_State(mutex_factory));
global_state().config().load_defaults();
if(args.config_file() != "")
global_config().load_inifile(args.config_file());