join memory status thread

master
moneroexamples 8 years ago
parent 3eda64407a
commit 0b350a027d

@ -1,57 +0,0 @@
//
// Created by mwo on 24/05/15.
//
// source: http://codereview.stackexchange.com/questions/13176/infix-iterator-code
// infix_iterator.h
#if !defined(INFIX_ITERATOR_H_)
#define INFIX_ITERATOR_H_
#include <ostream>
#include <iterator>
#include <string>
template <class T, class charT=char, class traits=std::char_traits<charT> >
class infix_ostream_iterator :
public std::iterator<std::output_iterator_tag, void, void, void, void>
{
std::basic_ostream<charT,traits> *os;
std::basic_string<charT> delimiter;
std::basic_string<charT> real_delim;
public:
typedef charT char_type;
typedef traits traits_type;
typedef std::basic_ostream<charT, traits> ostream_type;
infix_ostream_iterator(ostream_type &s)
: os(&s)
{}
infix_ostream_iterator(ostream_type &s, charT const *d)
: os(&s),
real_delim(d)
{}
infix_ostream_iterator<T, charT, traits> &operator=(T const &item)
{
*os << delimiter << item;
delimiter = real_delim;
return *this;
}
infix_ostream_iterator<T, charT, traits> &operator*() {
return *this;
}
infix_ostream_iterator<T, charT, traits> &operator++() {
return *this;
}
infix_ostream_iterator<T, charT, traits> &operator++(int) {
return *this;
}
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,10 +1,11 @@
#define CROW_ENABLE_SSL #define CROW_ENABLE_SSL
#include "ext/crow/crow.h"
#include "src/page.h"
#include "ext/crow/crow.h"
#include "src/CmdLineOptions.h" #include "src/CmdLineOptions.h"
#include "src/MicroCore.h" #include "src/MicroCore.h"
#include "src/page.h"
#include <fstream> #include <fstream>
#include <regex> #include <regex>
@ -590,12 +591,24 @@ main(int ac, const char* av[])
if (enable_emission_monitor == true) if (enable_emission_monitor == true)
{ {
// finish Emission monitoring thread in a cotrolled manner. // finish Emission monitoring thread in a cotrolled manner.
cout << "Waiting for emission monitoring thread to finish." << endl;
xmreg::CurrentBlockchainStatus::m_thread.interrupt(); xmreg::CurrentBlockchainStatus::m_thread.interrupt();
xmreg::CurrentBlockchainStatus::m_thread.join(); xmreg::CurrentBlockchainStatus::m_thread.join();
cout << "Emission monitoring thread joined." << endl; cout << "Emission monitoring thread finished." << endl;
} }
// finish mempool thread
cout << "Waiting for mempool monitoring thread to finish." << endl;
xmerg::MempoolStatus::m_thread.interrupt();
xmerg::MempoolStatus::m_thread.join();
cout << "Mmempool monitoring thread finished." << endl;
cout << "The explorer is terminating." << endl; cout << "The explorer is terminating." << endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;

@ -13,25 +13,29 @@
#define REMOVE_HASH_BRAKETS(a_hash) \ #define REMOVE_HASH_BRAKETS(a_hash) \
a_hash.substr(1, a_hash.size()-2) a_hash.substr(1, a_hash.size()-2)
#include "../ext/json.hpp"
#include "monero_headers.h" #include "monero_headers.h"
#include "../ext/infix_iterator.h"
#include "../ext/fmt/ostream.h" #include "../ext/fmt/ostream.h"
#include "../ext/fmt/format.h" #include "../ext/fmt/format.h"
#include "../ext/json.hpp"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> //#include <boost/date_time/posix_time/posix_time.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include <array> //#include <array>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
/** /**
* Some helper functions used in the example. * Some helper functions used in the example.
* Names are rather self-explanatory, so I think * Names are rather self-explanatory, so I think
@ -216,21 +220,6 @@ namespace xmreg
read(string filename); read(string filename);
/**
* prints an iterable such as vector
*/
template<typename T>
void print_iterable(const T & elems) {
infix_ostream_iterator<typename T::value_type>
oiter(std::cout, ",");
std::cout << "[";
std::copy(elems.begin(), elems.end(),oiter);
std::cout << "]" << std::endl;
}
pair<string, double> pair<string, double>
timestamps_time_scale(const vector<uint64_t>& timestamps, timestamps_time_scale(const vector<uint64_t>& timestamps,
uint64_t timeN, uint64_t resolution = 80, uint64_t timeN, uint64_t resolution = 80,

Loading…
Cancel
Save