cloud-sat/workers/clause.hpp
2022-09-15 10:31:41 +08:00

33 lines
685 B
C++

#ifndef _clause_hpp_INCLUDED
#define _clause_hpp_INCLUDED
struct clause_store {
int size, lbd;
int *data;
std::atomic<int> refs;
clause_store(int sz) {
size = sz;
data = (int*) malloc(sizeof(int) * sz);
lbd = 0;
refs = 1;
}
void increase_refs(int inc) {
refs += inc;
}
bool free_clause() {
int ref = refs.fetch_sub(1);
if (ref <= 1) {
// for (int i = 0; i < size; i++)
// printf("%d ", data[i]);
// puts("");
free(data);
return true;
}
return false;
}
~clause_store() {
puts("free");
}
};
#endif