← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3686: Remove deprecated code with very old boost.

 

------------------------------------------------------------
revno: 3686
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2015-06-16 15:54:56 +0200
message:
  Remove deprecated code with very old boost.
modified:
  core/Omega.cpp
  lib/pyutil/doc_opts.hpp
  py/wrapper/yadeWrapper.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/Omega.cpp'
--- core/Omega.cpp	2014-10-15 06:44:01 +0000
+++ core/Omega.cpp	2015-06-16 13:54:56 +0000
@@ -23,19 +23,11 @@
 
 #include<cxxabi.h>
 
-#if BOOST_VERSION<103500
-class RenderMutexLock: public boost::try_mutex::scoped_try_lock{
-	public:
-	RenderMutexLock(): boost::try_mutex::scoped_try_lock(Omega::instance().renderMutex,true){/*cerr<<"Lock renderMutex"<<endl;*/}
-	~RenderMutexLock(){/* cerr<<"Unlock renderMutex"<<endl; */}
-};
-#else
 class RenderMutexLock: public boost::mutex::scoped_lock{
 	public:
 	RenderMutexLock(): boost::mutex::scoped_lock(Omega::instance().renderMutex){/* cerr<<"Lock renderMutex"<<endl; */}
 	~RenderMutexLock(){/* cerr<<"Unlock renderMutex"<<endl;*/ }
 };
-#endif
 
 CREATE_LOGGER(Omega);
 SINGLETON_SELF(Omega);
@@ -65,8 +57,13 @@
 
 
 
-Real Omega::getRealTime(){ return (boost::posix_time::microsec_clock::local_time()-startupLocalTime).total_milliseconds()/1e3; }
-boost::posix_time::time_duration Omega::getRealTime_duration(){return boost::posix_time::microsec_clock::local_time()-startupLocalTime;}
+Real Omega::getRealTime(){
+	return (boost::posix_time::microsec_clock::local_time()-startupLocalTime).total_milliseconds()/1e3;
+}
+
+boost::posix_time::time_duration Omega::getRealTime_duration(){
+	return boost::posix_time::microsec_clock::local_time()-startupLocalTime;
+}
 
 
 void Omega::initTemps(){
@@ -76,8 +73,8 @@
 }
 
 void Omega::cleanupTemps(){
-  boost::filesystem::path tmpPath(tmpFileDir);
-  boost::filesystem::remove_all(tmpPath);
+	boost::filesystem::path tmpPath(tmpFileDir);
+	boost::filesystem::remove_all(tmpPath);
 }
 
 std::string Omega::tmpFilename(){
@@ -93,7 +90,6 @@
 
 void Omega::init(){
 	sceneFile="";
-	//resetScene();
 	resetAllScenes();
 	sceneAnother=shared_ptr<Scene>(new Scene);
 	timeInit();
@@ -104,8 +100,14 @@
 	startupLocalTime=boost::posix_time::microsec_clock::local_time();
 }
 
-void Omega::createSimulationLoop(){	simulationLoop=shared_ptr<ThreadRunner>(new ThreadRunner(&simulationFlow_));}
-void Omega::stop(){ LOG_DEBUG("");  if (simulationLoop&&simulationLoop->looping())simulationLoop->stop(); if (simulationLoop) simulationLoop=shared_ptr<ThreadRunner>(); }
+void Omega::createSimulationLoop(){
+	simulationLoop=shared_ptr<ThreadRunner>(new ThreadRunner(&simulationFlow_));
+}
+void Omega::stop(){
+	LOG_DEBUG("");
+	if (simulationLoop&&simulationLoop->looping())simulationLoop->stop();
+	if (simulationLoop) simulationLoop=shared_ptr<ThreadRunner>();
+}
 
 /* WARNING: even a single simulation step is run asynchronously; the call will return before the iteration is finished. */
 void Omega::step(){
@@ -115,7 +117,7 @@
 }
 
 void Omega::run(){
-	if(!simulationLoop){ LOG_ERROR("No Omega::simulationLoop? Creating one (please report bug)."); createSimulationLoop(); }
+	if(!simulationLoop){LOG_ERROR("No Omega::simulationLoop? Creating one (please report bug)."); createSimulationLoop(); }
 	if (simulationLoop && !simulationLoop->looping()){
 		simulationLoop->start();
 	}

=== modified file 'lib/pyutil/doc_opts.hpp'
--- lib/pyutil/doc_opts.hpp	2014-07-03 17:20:40 +0000
+++ lib/pyutil/doc_opts.hpp	2015-06-16 13:54:56 +0000
@@ -2,9 +2,4 @@
 
 // macro to set the same docstring generation options in all modules
 // disable_cpp_signatures apparently appeared after 1.35 or 1.34
-#if BOOST_VERSION<103600
-	#define YADE_SET_DOCSTRING_OPTS boost::python::docstring_options docopt; docopt.enable_all();
-#else
-	#define YADE_SET_DOCSTRING_OPTS boost::python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures();
-#endif
-
+#define YADE_SET_DOCSTRING_OPTS boost::python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures();

=== modified file 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp	2015-03-07 14:58:27 +0000
+++ py/wrapper/yadeWrapper.cpp	2015-06-16 13:54:56 +0000
@@ -92,25 +92,7 @@
 		return proxee->insert(b);
 	}
 	vector<Body::id_t> appendList(vector<shared_ptr<Body> > bb){
-		/* prevent crash when adding lots of bodies (not clear why it happens exactly, bt is like this:
-
-			#3  <signal handler called>
-			#4  0x000000000052483f in boost::detail::atomic_increment (pw=0x8089) at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:66
-			#5  0x00000000005248b3 in boost::detail::sp_counted_base::add_ref_copy (this=0x8081) at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:133
-			#6  0x00000000005249ca in shared_count (this=0x7fff2e44db48, r=@0x7f08ffd692b8) at /usr/include/boost/detail/shared_count.hpp:227
-			#7  0x00000000005258e3 in shared_ptr (this=0x7fff2e44db40) at /usr/include/boost/shared_ptr.hpp:165
-			#8  0x0000000000505cff in BodyRedirectionVectorIterator::getValue (this=0x846f040) at /home/vaclav/yade/trunk/core/containers/BodyRedirectionVector.cpp:47
-			#9  0x00007f0908af41ce in BodyContainerIteratorPointer::operator* (this=0x7fff2e44db60) at /home/vaclav/yade/build-trunk/include/yade-trunk/yade/core/BodyContainer.hpp:63
-			#10 0x00007f0908af420a in boost::foreach_detail_::deref<BodyContainer, mpl_::bool_<false> > (cur=@0x7fff2e44db60) at /usr/include/boost/foreach.hpp:750
-			#11 0x00007f0908adc5a9 in OpenGLRenderer::renderGeometricalModel (this=0x77f1240, scene=@0x1f49220) at pkg/common/RenderingEngine/OpenGLRenderer/OpenGLRenderer.cpp:441
-			#12 0x00007f0908adfb84 in OpenGLRenderer::render (this=0x77f1240, scene=@0x1f49220, selection=-1) at pkg/common/RenderingEngine/OpenGLRenderer/OpenGLRenderer.cpp:232
-
-		*/
-		#if BOOST_VERSION<103500
-			boost::try_mutex::scoped_try_lock lock(Omega::instance().renderMutex,true); // acquire lock on the mutex (true)
-		#else
-			boost::mutex::scoped_lock lock(Omega::instance().renderMutex);
-		#endif
+		boost::mutex::scoped_lock lock(Omega::instance().renderMutex);
 		vector<Body::id_t> ret; FOREACH(shared_ptr<Body>& b, bb){ret.push_back(append(b));} return ret;
 	}
 	Body::id_t clump(vector<Body::id_t> ids, unsigned int discretization){