Reduce Beast public interface and eliminate unused code:

Beast includes a lot of code for encapsulating cross-platform differences
which are not used or needed by rippled. Additionally, a lot of that code
implements functionality that is available from the standard library.

This moves away from custom implementations of features that the standard
library provides and reduces the number of platform-specific interfaces
andfeatures that Beast makes available.

Highlights include:
* Use std:: instead of beast implementations when possible
* Reduce the use of beast::String in public interfaces
* Remove Windows-specific COM and Registry code
* Reduce the public interface of beast::File
* Reduce the public interface of beast::SystemStats
* Remove unused sysctl/getsysinfo functions
* Remove beast::Logger
This commit is contained in:
Nik Bougalis
2014-10-13 14:20:54 -07:00
committed by Vinnie Falco
parent fefdb32d08
commit 186ca9c235
82 changed files with 361 additions and 7762 deletions

View File

@@ -21,12 +21,18 @@
namespace beast {
Workers::Workers (Callback& callback, String const& threadNames, int numberOfThreads)
: m_callback (callback)
, m_threadNames (threadNames)
, m_allPaused (true, true)
, m_semaphore (0)
, m_numberOfThreads (0)
Workers::Workers (
Callback& callback,
std::string const& threadNames,
int numberOfThreads)
: m_callback (callback)
, m_threadNames (threadNames)
, m_allPaused (true, true)
, m_semaphore (0)
, m_numberOfThreads (0)
, m_activeCount (0)
, m_pauseCount (0)
, m_runningTaskCount (0)
{
setNumberOfThreads (numberOfThreads);
}
@@ -112,7 +118,7 @@ void Workers::addTask ()
int Workers::numberOfCurrentlyRunningTasks () const noexcept
{
return m_runningTaskCount.get ();
return m_runningTaskCount.load ();
}
void Workers::deleteWorkers (LockFreeStack <Worker>& stack)
@@ -166,7 +172,7 @@ void Workers::Worker::run ()
// See if there's a pause request. This
// counts as an "internal task."
//
int pauseCount = m_workers.m_pauseCount.get ();
int pauseCount = m_workers.m_pauseCount.load ();
if (pauseCount > 0)
{
@@ -242,7 +248,7 @@ public:
}
WaitableEvent finished;
Atomic <int> count;
std::atomic <int> count;
};
template <class T1, class T2>
@@ -254,10 +260,7 @@ public:
void testThreads (int const threadCount)
{
std::stringstream ss;
ss <<
"threadCount = " << threadCount;
testcase (ss.str());
testcase ("threadCount = " + std::to_string (threadCount));
TestCallback cb (threadCount);
@@ -278,7 +281,7 @@ public:
w.pauseAllThreadsAndWait ();
int const count (cb.count.get ());
int const count (cb.count.load ());
expectEquals (count, 0);
}