Threads safe socket rate stats

This commit is contained in:
Alexey Rybalchenko 2016-05-12 09:13:57 +02:00 committed by Mohammad Al-Turany
parent 3353e214a7
commit 31456e71ff
2 changed files with 11 additions and 8 deletions

View File

@ -16,6 +16,7 @@
#define FAIRMQSOCKETNN_H_
#include <vector>
#include <atomic>
#include "FairMQSocket.h"
@ -64,10 +65,10 @@ class FairMQSocketNN : public FairMQSocket
private:
int fSocket;
std::string fId;
unsigned long fBytesTx;
unsigned long fBytesRx;
unsigned long fMessagesTx;
unsigned long fMessagesRx;
std::atomic<unsigned long> fBytesTx;
std::atomic<unsigned long> fBytesRx;
std::atomic<unsigned long> fMessagesTx;
std::atomic<unsigned long> fMessagesRx;
};
#endif /* FAIRMQSOCKETNN_H_ */

View File

@ -15,6 +15,8 @@
#ifndef FAIRMQSOCKETZMQ_H_
#define FAIRMQSOCKETZMQ_H_
#include <atomic>
#include <boost/shared_ptr.hpp>
#include "FairMQSocket.h"
@ -65,10 +67,10 @@ class FairMQSocketZMQ : public FairMQSocket
private:
void* fSocket;
std::string fId;
unsigned long fBytesTx;
unsigned long fBytesRx;
unsigned long fMessagesTx;
unsigned long fMessagesRx;
std::atomic<unsigned long> fBytesTx;
std::atomic<unsigned long> fBytesRx;
std::atomic<unsigned long> fMessagesTx;
std::atomic<unsigned long> fMessagesRx;
static boost::shared_ptr<FairMQContextZMQ> fContext;
};