Add orthogonal OK/ERROR states.

Replace state check mutex with atomic.

Update DDS example documentation.
This commit is contained in:
Alexey Rybalchenko
2015-08-24 17:35:30 +02:00
committed by Mohammad Al-Turany
parent a7ab33a10e
commit fbf7dbf2ba
38 changed files with 838 additions and 615 deletions

View File

@@ -18,6 +18,8 @@
#include "FairMQExample3Sampler.h"
#include "FairMQLogger.h"
using namespace std;
FairMQExample3Sampler::FairMQExample3Sampler()
: fText()
{
@@ -25,18 +27,19 @@ FairMQExample3Sampler::FairMQExample3Sampler()
void FairMQExample3Sampler::CustomCleanup(void *data, void *object)
{
delete (std::string*)object;
delete (string*)object;
}
void FairMQExample3Sampler::Run()
{
// Check if we are still in the RUNNING state
while (CheckCurrentState(RUNNING))
{
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
std::string* text = new std::string(fText);
string* text = new string(fText);
FairMQMessage* msg = fTransportFactory->CreateMessage(const_cast<char*>(text->c_str()), text->length(), CustomCleanup, text);
unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage(const_cast<char*>(text->c_str()), text->length(), CustomCleanup, text));
LOG(INFO) << "Sending \"" << fText << "\"";
@@ -48,7 +51,7 @@ FairMQExample3Sampler::~FairMQExample3Sampler()
{
}
void FairMQExample3Sampler::SetProperty(const int key, const std::string& value)
void FairMQExample3Sampler::SetProperty(const int key, const string& value)
{
switch (key)
{
@@ -61,7 +64,7 @@ void FairMQExample3Sampler::SetProperty(const int key, const std::string& value)
}
}
std::string FairMQExample3Sampler::GetProperty(const int key, const std::string& default_ /*= ""*/)
string FairMQExample3Sampler::GetProperty(const int key, const string& default_ /*= ""*/)
{
switch (key)
{