SL_U2_SJ
Obai Albek 2025-05-23 15:36:29 +02:00
parent 3e6281177a
commit 9982245715
2 changed files with 28 additions and 26 deletions

View File

@ -52,9 +52,8 @@ public class ThreadsafeSimplifiedList<T> implements SimplifiedList<T> {
}
}
try {
return (ptr.element);
}
finally {
return delay(ptr.element);
} finally {
ptr.lock.unlock();
}
}
@ -113,10 +112,13 @@ public class ThreadsafeSimplifiedList<T> implements SimplifiedList<T> {
throw new IndexOutOfBoundsException(index + " out of bounds");
}
}
try {
var prevElement = ptr.element;
ptr.element = element;
ptr.lock.unlock();
return prevElement;
} finally {
ptr.lock.unlock();
}
}
/**