Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
SequentialWorker.hpp
1#pragma once
2
3#include "../solvers/SolverInterface.hpp"
4#include "utils/Threading.hpp"
5#include "working/WorkingStrategy.hpp"
6
7#include <vector>
8
9// Main executed by worker threads
10static void*
11mainWorker(void* arg);
12
18{
19 public:
20 SequentialWorker(std::shared_ptr<SolverInterface> solver_);
21
23
24 void solve(const std::vector<int>& cube);
25
26 void join(WorkingStrategy* winner, SatResult res, const std::vector<int>& model);
27
28 void setSolverInterrupt();
29
30 void unsetSolverInterrupt();
31
32 void waitInterrupt();
33
34 std::shared_ptr<SolverInterface> solver;
35
36 protected:
37 friend void* mainWorker(void* arg);
38
39 Thread* worker;
40
41 std::vector<int> actualCube;
42
43 std::atomic<bool> force;
44
45 std::atomic<bool> waitJob;
46
47 Mutex waitInterruptLock;
48
49 pthread_mutex_t mutexStart;
50 pthread_cond_t mutexCondStart;
51};
Mutex class.
Definition Threading.hpp:18
Basic Implementation of WorkingStrategy for a sequential execution.
Definition SequentialWorker.hpp:18
Thread class.
Definition Threading.hpp:46
Base Interface for Working Strategies.
Definition WorkingStrategy.hpp:18
SatResult
Enumeration for SAT solver results.
Definition SolverInterface.hpp:39