add implementation for remove to fine grained_list

This commit is contained in:
2020-12-30 16:26:16 +01:00
parent bd468abba7
commit 5932ab4af9

View File

@@ -69,6 +69,27 @@ bool Set::add(int element) {
} }
bool Set::rmv(int element) { bool Set::rmv(int element) {
this->first->lock();
Node* p = this->first;
Node* c = p->next;
c->lock();
while (c->data < element) {
p->unlock();
c = c->next;
c->lock();
if (c->data == element) {
p->next = c->next;
c->unlock();
p->unlock();
return true;
}
}
c->unlock();
p->unlock();
return false; return false;
} }
bool Set::ctn(int element) { bool Set::ctn(int element) {