mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-08 05:03:59 -05:00
48 lines
909 B
C++
48 lines
909 B
C++
/*
|
|
* ThreadQueue.h
|
|
*
|
|
*/
|
|
|
|
#ifndef PROCESSOR_THREADQUEUE_H_
|
|
#define PROCESSOR_THREADQUEUE_H_
|
|
|
|
#include "ThreadJob.h"
|
|
#include "Tools/NamedStats.h"
|
|
|
|
class ThreadQueue
|
|
{
|
|
WaitQueue<ThreadJob> in, out;
|
|
Lock lock;
|
|
int left;
|
|
NamedCommStats comm_stats;
|
|
|
|
public:
|
|
static thread_local ThreadQueue* thread_queue;
|
|
|
|
map<string, TimerWithComm> timers;
|
|
Timer wait_timer;
|
|
NamedStats stats;
|
|
|
|
ThreadQueue() :
|
|
left(0)
|
|
{
|
|
}
|
|
|
|
bool available()
|
|
{
|
|
return left == 0;
|
|
}
|
|
|
|
void schedule(const ThreadJob& job);
|
|
ThreadJob next();
|
|
void finished(const ThreadJob& job);
|
|
void finished(const ThreadJob& job, const NamedCommStats& comm_stats,
|
|
const NamedStats& stats = {});
|
|
ThreadJob result();
|
|
|
|
void set_comm_stats(const NamedCommStats& new_comm_stats);
|
|
NamedCommStats get_comm_stats();
|
|
};
|
|
|
|
#endif /* PROCESSOR_THREADQUEUE_H_ */
|