MOTION
0.01
Framework for mixed-protocol multi-party computation
|
Go to the documentation of this file.
23 #ifndef LOCKED_FIBER_QUEUE_HPP
24 #define LOCKED_FIBER_QUEUE_HPP
26 #include <boost/fiber/condition_variable.hpp>
27 #include <boost/fiber/mutex.hpp>
46 std::lock_guard lock(mutex_);
47 return queue_.empty();
54 std::lock_guard lock(mutex_);
63 std::scoped_lock lock(mutex_);
66 condition_variable_.notify_all();
74 throw std::logic_error(
"Tried to enqueue in closed LockedFiberQueue");
77 std::scoped_lock lock(mutex_);
80 condition_variable_.notify_one();
85 throw std::logic_error(
"Tried to enqueue in closed LockedFiberQueue");
88 std::scoped_lock lock(mutex_);
89 queue_.push(std::move(item));
91 condition_variable_.notify_one();
98 std::unique_lock lock(mutex_);
99 if (queue_.empty() && closed_) {
102 if (queue_.empty() && !closed_) {
103 condition_variable_.wait(lock, [
this] {
return !this->queue_.empty() || this->closed_; });
105 if (queue_.empty()) {
108 auto item = std::move(queue_.front());
111 return std::optional<T>(std::move(item));
115 bool closed_ =
false;
116 std::queue<T> queue_;
117 mutable boost::fibers::mutex mutex_;
118 boost::fibers::condition_variable_any condition_variable_;
123 #endif // LOCKED_QUEUE_HPP
void Add(const communication::TransportStatistics &statistics)
Definition: analysis.cpp:125
Definition: analysis.h:43
std::unique_ptr< Party > PartyPointer
Definition: party.h:387
void enqueue(T &&item)
Definition: locked_fiber_queue.h:83
bool empty() const noexcept
Definition: locked_fiber_queue.h:45
std::pair< program_options::variables_map, std::vector< bool > > ParseProgramOptions(int ac, char *av[])
Definition: innerproduct_main.cpp:117
void enqueue(const T &item)
Definition: locked_fiber_queue.h:72
Definition: tcp_transport.h:69
const std::regex kPartyArgumentRegex("([01]),([^,]+),(\\d{1,5})")
std::vector< TcpConnectionConfiguration > TcpPartiesConfiguration
Definition: tcp_transport.h:62
Definition: algorithm_description.cpp:35
help
Definition: geninput.py:150
std::string PrintStatistics(const std::string &experiment_name, const AccumulatedRunTimeStatistics &execution_statistics, const AccumulatedCommunicationStatistics &communication_statistics)
Definition: analysis.cpp:176
encrypto::motion::RunTimeStatistics EvaluateProtocol(encrypto::motion::PartyPointer &party, std::size_t number_of_simd, encrypto::motion::MpcProtocol protocol, bool check)
Definition: aes128.cpp:56
MpcProtocol
Definition: typedefs.h:140
std::optional< T > dequeue() noexcept
Definition: locked_fiber_queue.h:97
bool IsClosed() const noexcept
Definition: locked_fiber_queue.h:53
void close() noexcept
Definition: locked_fiber_queue.h:61
Definition: locked_fiber_queue.h:40
std::tuple< std::size_t, std::string, std::uint16_t > ParsePartyArgument(const std::string &party_argument)
Definition: innerproduct_main.cpp:106
bool CheckPartyArgumentSyntax(const std::string &party_argument)
Definition: innerproduct_main.cpp:101
int main(int ac, char *av[])
Definition: innerproduct_main.cpp:49
Definition: analysis.h:65
encrypto::motion::PartyPointer CreateParty(const program_options::variables_map &user_options)
Definition: innerproduct_main.cpp:199
std::vector< std::unique_ptr< Transport > > SetupConnections()
Definition: tcp_transport.cpp:203