Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include <boost/thread.hpp>
00007 #include <saga/saga/base.hpp>
00008
00010 namespace saga
00011 {
00012 namespace detail
00013 {
00014
00015
00016 static boost::mutex &mutex_instance()
00017 {
00018 static boost::mutex mutex;
00019 return mutex;
00020 }
00021 static void mutex_init()
00022 {
00023 mutex_instance();
00024 }
00025
00027
00028 char *safe_getenv(char const* name)
00029 {
00030 static boost::once_flag been_here = BOOST_ONCE_INIT;
00031 boost::call_once(mutex_init, been_here);
00032
00033 boost::mutex::scoped_lock l(mutex_instance());
00034 return getenv(name);
00035 }
00037
00038 }
00039 }