applies concurrency fixes
This commit is contained in:
1 parent
42e0d83403
commit
28eb1b673e
56 files changed
+1462
-372
No files matched your search
+4
-2
@@ -81,7 +81,7 @@ public class FstDbLoader implements IWaveformDbLoader, IFstDatabaseBuilder {
|
||||
pcs.firePropertyChange(IWaveformDbLoader.LOADING_FINISHED, null, null);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
public synchronized void dispose() {
|
||||
if(parser!=null) {
|
||||
parser.close();
|
||||
parser=null;
|
||||
@@ -183,7 +183,9 @@ public class FstDbLoader implements IWaveformDbLoader, IFstDatabaseBuilder {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
public void getEvents(int id, int width, IEventList values) {
|
||||
public synchronized void getEvents(int id, int width, IEventList values) {
|
||||
com.minres.scviewer.database.ReadCancellation.check();
|
||||
if (parser == null) throw new IllegalStateException("FST recording is closed");
|
||||
if(values instanceof EventList)
|
||||
parser.getValueChanges(id, width, timeScaleFactor, (EventList) values);
|
||||
}
|
||||
|
||||
+9
-5
@@ -30,9 +30,9 @@ class FstFileParser {
|
||||
this.file=file;
|
||||
}
|
||||
|
||||
public boolean open(IFstDatabaseBuilder builder) {
|
||||
public synchronized boolean open(IFstDatabaseBuilder builder) {
|
||||
fst = FstLibrary.fstReaderOpen(file.getAbsolutePath());
|
||||
if(!fst.equals(Pointer.NULL)) {
|
||||
if(fst != null && !fst.equals(Pointer.NULL)) {
|
||||
// String version = FstLibrary.fstReaderGetVersionString(fst);
|
||||
long endTime = FstLibrary.fstReaderGetEndTime(fst);
|
||||
byte timeScale = FstLibrary.fstReaderGetTimescale(fst);
|
||||
@@ -76,7 +76,8 @@ class FstFileParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void getValueChanges(final int id, final int width, long timeScale, final EventList values) {
|
||||
public synchronized void getValueChanges(final int id, final int width, long timeScale, final EventList values) {
|
||||
if (fst == null) throw new IllegalStateException("FST reader is closed");
|
||||
FstLibrary.fstReaderClrFacProcessMaskAll(fst);
|
||||
FstLibrary.fstReaderSetFacProcessMask(fst, id);
|
||||
FstLibrary.iterateValueChanges(fst, new ValueChangeCallback() {
|
||||
@@ -86,8 +87,11 @@ class FstFileParser {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void close() {
|
||||
FstLibrary.fstReaderClose(fst);
|
||||
public synchronized void close() {
|
||||
if (fst != null) {
|
||||
FstLibrary.fstReaderClose(fst);
|
||||
fst = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user