13 #ifndef __PROCESS_RUN_QUEUE_HPP__ 14 #define __PROCESS_RUN_QUEUE_HPP__ 35 #ifdef LOCK_FREE_RUN_QUEUE 36 #include <concurrentqueue.h> 37 #endif // LOCK_FREE_RUN_QUEUE 50 #ifndef LOCK_FREE_RUN_QUEUE 56 synchronized (mutex) {
57 std::list<ProcessBase*>::iterator it =
std::find(
62 if (it != processes.end()) {
78 synchronized (mutex) {
79 processes.push_back(process);
88 synchronized (mutex) {
89 if (!processes.empty()) {
91 processes.pop_front();
103 synchronized (mutex) {
104 return processes.empty();
119 std::atomic_long
epoch = ATOMIC_VAR_INIT(0L);
122 std::list<ProcessBase*> processes;
126 #ifndef LAST_IN_FIRST_OUT_FIXED_SIZE_SEMAPHORE 130 #endif // LAST_IN_FIRST_OUT_FIXED_SIZE_SEMAPHORE 133 #else // LOCK_FREE_RUN_QUEUE 152 queue.enqueue(process);
166 while (!queue.try_dequeue(process)) {
167 if (semaphore.decomissioned()) {
176 return queue.size_approx() == 0;
181 semaphore.decomission();
186 return semaphore.capacity();
190 std::atomic_long
epoch = ATOMIC_VAR_INIT(0L);
193 moodycamel::ConcurrentQueue<ProcessBase*> queue;
195 #ifndef LAST_IN_FIRST_OUT_FIXED_SIZE_SEMAPHORE 199 #endif // LAST_IN_FIRST_OUT_FIXED_SIZE_SEMAPHORE 202 #endif // LOCK_FREE_RUN_QUEUE 206 #endif // __PROCESS_RUN_QUEUE_HPP__
bool empty()
Definition: run_queue.hpp:101
Definition: run_queue.hpp:51
bool extract(ProcessBase *process)
Definition: run_queue.hpp:54
size_t capacity() const
Definition: run_queue.hpp:113
Definition: process.hpp:72
std::atomic_long epoch
Definition: run_queue.hpp:119
void decomission()
Definition: semaphore.hpp:159
ProcessBase * dequeue()
Definition: run_queue.hpp:86
size_t capacity() const
Definition: semaphore.hpp:178
void signal()
Definition: semaphore.hpp:124
void enqueue(ProcessBase *process)
Definition: run_queue.hpp:76
void wait()
Definition: semaphore.hpp:142
Definition: semaphore.hpp:244
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
Definition: executor.hpp:48
void decomission()
Definition: run_queue.hpp:108
void wait()
Definition: run_queue.hpp:71
Definition: semaphore.hpp:139
Try< std::list< std::string > > find(const std::string &directory, const std::string &pattern)
Definition: find.hpp:37