mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-30 23:45:48 +00:00
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:
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user