mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
beast cleaning and tidying:
* Consolidate small modules into one * Remove Android-specific platform support * Remove Chrono.h from beast_core.h * Removed files: - TypeTraits.h - Utility.h - Net.h - Asio.h * Remove zlib support: - Remove inline zlib library sources - Remove GZIPCompressorOutputStream - Remove GZIPDecompressorInputStream * Remove obsolete or unused classes: - AbstractObject - BigInteger - BufferedInputStream - CacheLine - CPUMeter - DatagramSocket - DynamicObject - FileLogger - FPUFlags - Identifier - JSON - LocalisedStrings - MACAddress - MemoryAlignment - MemoryInputStream - MemoryMappedFile - NamedValueSet - OptionalScopedPointer - PerformanceCounter - PropertySet - ScopedTimeInterval - SparseSet - SpinDelay - StreamingSocket - StringPool - SubregionStream - Uuid - Variant
This commit is contained in:
@@ -114,11 +114,6 @@ int Workers::numberOfCurrentlyRunningTasks () const noexcept
|
||||
return m_runningTaskCount.get ();
|
||||
}
|
||||
|
||||
double Workers::getUtilization () const
|
||||
{
|
||||
return m_usage.getUtilization();
|
||||
}
|
||||
|
||||
void Workers::deleteWorkers (LockFreeStack <Worker>& stack)
|
||||
{
|
||||
for (;;)
|
||||
@@ -165,45 +160,37 @@ void Workers::Worker::run ()
|
||||
{
|
||||
// Acquire a task or "internal task."
|
||||
//
|
||||
m_workers.m_semaphore.wait ();
|
||||
|
||||
// See if there's a pause request. This
|
||||
// counts as an "internal task."
|
||||
//
|
||||
int pauseCount = m_workers.m_pauseCount.get ();
|
||||
|
||||
if (pauseCount > 0)
|
||||
{
|
||||
CPUMeter::ScopedIdleTime elapsed (m_workers.m_usage);
|
||||
// Try to decrement
|
||||
pauseCount = --m_workers.m_pauseCount;
|
||||
|
||||
m_workers.m_semaphore.wait ();
|
||||
}
|
||||
|
||||
{
|
||||
CPUMeter::ScopedActiveTime elapsed (m_workers.m_usage);
|
||||
|
||||
// See if there's a pause request. This
|
||||
// counts as an "internal task."
|
||||
//
|
||||
int pauseCount = m_workers.m_pauseCount.get ();
|
||||
|
||||
if (pauseCount > 0)
|
||||
if (pauseCount >= 0)
|
||||
{
|
||||
// Try to decrement
|
||||
pauseCount = --m_workers.m_pauseCount;
|
||||
|
||||
if (pauseCount >= 0)
|
||||
{
|
||||
// We got paused
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Undo our decrement
|
||||
++m_workers.m_pauseCount;
|
||||
}
|
||||
// We got paused
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Undo our decrement
|
||||
++m_workers.m_pauseCount;
|
||||
}
|
||||
|
||||
// We couldn't pause so we must have gotten
|
||||
// unblocked in order to process a task.
|
||||
//
|
||||
++m_workers.m_runningTaskCount;
|
||||
m_workers.m_callback.processTask ();
|
||||
--m_workers.m_runningTaskCount;
|
||||
}
|
||||
|
||||
// We couldn't pause so we must have gotten
|
||||
// unblocked in order to process a task.
|
||||
//
|
||||
++m_workers.m_runningTaskCount;
|
||||
m_workers.m_callback.processTask ();
|
||||
--m_workers.m_runningTaskCount;
|
||||
|
||||
// Put the name back in case the callback changed it
|
||||
Thread::setCurrentThreadName (Thread::getThreadName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user