Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 0b69c66

Browse files
committed
Revert "fix: use fair ReentrantLocks for parsing and cancellation"
This reverts commit e67e40a.
1 parent 4fc68b7 commit 0b69c66

File tree

1 file changed

+4
-15
lines changed
  • android-tree-sitter/src/main/java/com/itsaky/androidide/treesitter

1 file changed

+4
-15
lines changed

android-tree-sitter/src/main/java/com/itsaky/androidide/treesitter/TSParser.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
*/
3030
public class TSParser extends TSNativeObject {
3131

32-
protected final ReentrantLock parseLock = new ReentrantLock(true);
33-
protected final ReentrantLock cancellationLock = new ReentrantLock(true);
32+
protected final ReentrantLock parseLock = new ReentrantLock();
3433
protected final AtomicBoolean isParsing = new AtomicBoolean(false);
3534
protected final AtomicBoolean isCancellationRequested = new AtomicBoolean(false);
3635

@@ -257,22 +256,12 @@ public boolean requestCancellation() {
257256
return requested;
258257
}
259258

260-
protected void setCancellationRequested(boolean isRequested) {
261-
cancellationLock.lock();
262-
try {
263-
this.isCancellationRequested.set(isRequested);
264-
} finally {
265-
cancellationLock.unlock();
266-
}
259+
protected synchronized void setCancellationRequested(boolean isRequested) {
260+
this.isCancellationRequested.set(isRequested);
267261
}
268262

269263
protected synchronized boolean isCancellationRequested() {
270-
cancellationLock.lock();
271-
try {
272-
return this.isCancellationRequested.get();
273-
} finally {
274-
cancellationLock.unlock();
275-
}
264+
return this.isCancellationRequested.get();
276265
}
277266

278267
/**

0 commit comments

Comments
 (0)