Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/xrpld/core/detail/Workers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Workers::setNumberOfThreads(int numberOfThreads)
++m_pauseCount;

// Pausing a thread counts as one "internal task"
m_semaphore.notify();
m_semaphore.release();
}
}

Expand All @@ -128,7 +128,7 @@ Workers::stop()
void
Workers::addTask()
{
m_semaphore.notify();
m_semaphore.release();
}

int
Expand Down Expand Up @@ -213,7 +213,7 @@ Workers::Worker::run()

// Acquire a task or "internal task."
//
m_workers.m_semaphore.wait();
m_workers.m_semaphore.acquire();

// See if there's a pause request. This
// counts as an "internal task."
Expand Down
11 changes: 5 additions & 6 deletions src/xrpld/core/detail/Workers.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
#ifndef RIPPLE_CORE_WORKERS_H_INCLUDED
#define RIPPLE_CORE_WORKERS_H_INCLUDED

#include <xrpld/core/detail/semaphore.h>

#include <xrpl/beast/core/LockFreeStack.h>

#include <atomic>
#include <condition_variable>
#include <mutex>
#include <semaphore>
#include <string>
#include <thread>

Expand Down Expand Up @@ -223,10 +222,10 @@ class Workers
std::condition_variable m_cv; // signaled when all threads paused
std::mutex m_mut;
bool m_allPaused;
semaphore m_semaphore; // each pending task is 1 resource
int m_numberOfThreads; // how many we want active now
std::atomic<int> m_activeCount; // to know when all are paused
std::atomic<int> m_pauseCount; // how many threads need to pause now
std::counting_semaphore<> m_semaphore; // each pending task is 1 resource
int m_numberOfThreads; // how many we want active now
std::atomic<int> m_activeCount; // to know when all are paused
std::atomic<int> m_pauseCount; // how many threads need to pause now
std::atomic<int>
m_runningTaskCount; // how many calls to processTask() active
beast::LockFreeStack<Worker> m_everyone; // holds all created workers
Expand Down
83 changes: 0 additions & 83 deletions src/xrpld/core/detail/semaphore.h

This file was deleted.

Loading