mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 23:15:24 +02:00
![]() The indexer has a feature that allows readers of the index to read the index in the middle of write operations. This is done by using a YeildableIndexLock. The YeildableIndexLock's yield method can be called to temporarily give up the write lock. However the assumption in the code was that it would always successfully reaquire the lock after that. However, if the indexing was cancelled the lock would fail to be reaquired. Therefore the code that thinks it owns the lock no longer owns it. In this case the code in PDOMWriter.storeSymbolsInIndex's finally block. Therefore I have added an new exception type to explicitly identify this use case so the original code can differentiate between cases where an exception was thrown where the lock is still held, and cases where the lock is no longer held. Note that instead of a new exception caught like this: ```java } catch (FailedToReAcquireLockException e) { hasLock = false; e.reThrow(); ``` I could have done this: ```java } catch (InterruptedException | OperationCanceledException e) { hasLock = false; throw e; ``` But it is not obvious that nothing else other than the acquire can raise an OperationCanceledException because it is a RuntimeException. By having a new checked exception we can know for sure that in the finally block we have lost our lock. There are no API implications of this change as all the classes and interfaces are internal to CDT. Fixes #128 |
||
---|---|---|
.. | ||
org.eclipse.cdt.core | ||
org.eclipse.cdt.core.linux | ||
org.eclipse.cdt.core.linux.aarch64 | ||
org.eclipse.cdt.core.linux.ppc64le | ||
org.eclipse.cdt.core.linux.x86_64 | ||
org.eclipse.cdt.core.macosx | ||
org.eclipse.cdt.core.native | ||
org.eclipse.cdt.core.tests | ||
org.eclipse.cdt.core.win32 | ||
org.eclipse.cdt.core.win32.x86_64 | ||
org.eclipse.cdt.ui | ||
org.eclipse.cdt.ui.tests | ||
pom.xml |