Reduce Beast dependencies by leveraging C++11 features:

* Remove beast::Atomic (RIPD-728):
  * Use std-provided alternatives
  * Eliminate atomic variables where possible

* Cleanup beast::Thread interface:
  * Use std::string instead of beast::String
  * Remove unused functions and parameters

* Remove unused code:
  * beast::ThreadLocalValue
  * beast::ServiceQueue
This commit is contained in:
Nik Bougalis
2014-12-22 02:45:36 -08:00
parent c01b4e6baa
commit 1d6721d345
20 changed files with 47 additions and 2229 deletions

View File

@@ -141,7 +141,7 @@ void Workers::deleteWorkers (LockFreeStack <Worker>& stack)
//------------------------------------------------------------------------------
Workers::Worker::Worker (Workers& workers, String const& threadName)
Workers::Worker::Worker (Workers& workers, std::string const& threadName)
: Thread (threadName)
, m_workers (workers)
{
@@ -232,7 +232,6 @@ void Workers::Worker::run ()
class Workers_test : public unit_test::suite
{
public:
struct TestCallback : Workers::Callback
{
explicit TestCallback (int count_)
@@ -251,13 +250,6 @@ public:
std::atomic <int> count;
};
template <class T1, class T2>
bool
expectEquals (T1 const& t1, T2 const& t2)
{
return expect (t1 == t2);
}
void testThreads (int const threadCount)
{
testcase ("threadCount = " + std::to_string (threadCount));
@@ -276,14 +268,12 @@ public:
// 10 seconds should be enough to finish on any system
//
bool signaled = cb.finished.wait (10 * 1000);
expect (signaled, "timed out");
w.pauseAllThreadsAndWait ();
int const count (cb.count.load ());
expectEquals (count, 0);
// We had better finished all our work!
expect (cb.count.load () == 0, "Did not complete task!");
}
void run ()