Revision: 7398
http://playerstage.svn.sourceforge.net/playerstage/?rev=7398&view=rev
Author: natepak
Date: 2009-03-09 07:21:49 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
Remove boost semaphores
Modified Paths:
--------------
code/branches/federation/gazebo/libgazebo/SimIface.cc
code/branches/federation/gazebo/libgazebo/gazebo.h
code/branches/federation/gazebo/server/World.cc
Modified: code/branches/federation/gazebo/libgazebo/SimIface.cc
===================================================================
--- code/branches/federation/gazebo/libgazebo/SimIface.cc 2009-03-09
07:13:58 UTC (rev 7397)
+++ code/branches/federation/gazebo/libgazebo/SimIface.cc 2009-03-09
07:21:49 UTC (rev 7398)
@@ -76,15 +76,15 @@
while (true)
{
- boost::mutex::scoped_lock lock(*(this->mutex));
+ boost::mutex::scoped_lock lock(this->mutex);
printf("Waiting on a condition\n");
// Wait on a condition that signals when the thread should run
- this->goAckCond->wait(lock);
+ this->goAckCond.wait(lock);
printf("Blocking on gazebo, which is running for %d microseconds\n",
this->blockTimeUs);
printf("Thread is waiting at semaphore\n");
// Wait for Gazebo to send a Post
// this->data->sem.post();
- this->data->sem.wait();
+ //this->data->sem.wait();
printf("Thread is sending a signal to the callback\n");
// Signal the callback function
this->goAckSignal();
Modified: code/branches/federation/gazebo/libgazebo/gazebo.h
===================================================================
--- code/branches/federation/gazebo/libgazebo/gazebo.h 2009-03-09 07:13:58 UTC
(rev 7397)
+++ code/branches/federation/gazebo/libgazebo/gazebo.h 2009-03-09 07:21:49 UTC
(rev 7398)
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <boost/signal.hpp>
-#include <boost/interprocess/sync/interprocess_semaphore.hpp>
+//#include <boost/interprocess/sync/interprocess_semaphore.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
@@ -440,7 +440,7 @@
public: SimulationRequestData responses[GAZEBO_SIMULATION_MAX_REQUESTS];
public: unsigned int responseCount;
- public: boost::interprocess::interprocess_semaphore sem;
+// public: boost::interprocess::interprocess_semaphore sem;
};
/// \brief Common simulation interface
@@ -474,19 +474,23 @@
request->runTime = us;
this->Unlock();
- // Set the time the thread should block for
- this->blockTimeUs = us;
+ {
+ boost::mutex::scoped_lock lock(this->mutex);
- // Connect the callback. This is signaled when the thread
- // (below) finishes waiting
- this->goAckSignal.connect( subscriber );
+ // Set the time the thread should block for
+ this->blockTimeUs = us;
+ // Connect the callback. This is signaled when the thread
+ // (below) finishes waiting
+ this->goAckSignal.connect( subscriber );
+ }
+
/*printf("Waiting on the semaphore\n");
this->data->sem.wait();
printf("Done Waiting on the semaphore\n");
*/
- this->goAckCond->notify_one();
+ this->goAckCond.notify_one();
}
/// \brief Pause the simulation
@@ -519,8 +523,8 @@
private: unsigned int blockTimeUs;
private: boost::signal<void (void)> goAckSignal;
private: boost::thread *goAckThread;
- private: boost::condition *goAckCond;
- private: boost::mutex *mutex;
+ private: boost::condition goAckCond;
+ private: boost::mutex mutex;
/// Pointer to the simulation data
Modified: code/branches/federation/gazebo/server/World.cc
===================================================================
--- code/branches/federation/gazebo/server/World.cc 2009-03-09 07:13:58 UTC
(rev 7397)
+++ code/branches/federation/gazebo/server/World.cc 2009-03-09 07:21:49 UTC
(rev 7398)
@@ -209,7 +209,7 @@
Simulator::Instance()->GetSimTime(), this->simPauseTime);
//this->simIface->Lock(1);
printf("Sem Post\n");
- this->simIface->data->sem.post();
+ //this->simIface->data->sem.post();
printf("Sem Post done\n");
//this->simIface->Unlock();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit