Fix shm index update race
There was a lingering issue where the fsp daemon would sync its shm array with the source data and we'd set the start/end indices to the same value. Under some races a reader would then read an empty `.array` which it wasn't expecting. This fixes that as well as tidies up the `ShmArray.push()` logic and adds a temporary check in `.array` for zero length if the array hasn't been written yet. We can now start removing read array length checks in consumer code and hopefully no more races will show up. Revert to old shm "last" meaning last rowpy3.10_support
parent
51373789fe
commit
9951e1d4c9
|
@ -936,11 +936,12 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|
||||||
) -> pg.GraphicsObject:
|
) -> pg.GraphicsObject:
|
||||||
"""Update the named internal graphics from ``array``.
|
'''Update the named internal graphics from ``array``.
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
assert len(array)
|
||||||
data_key = array_key or graphics_name
|
data_key = array_key or graphics_name
|
||||||
|
|
||||||
if graphics_name not in self._overlays:
|
if graphics_name not in self._overlays:
|
||||||
self._arrays['ohlc'] = array
|
self._arrays['ohlc'] = array
|
||||||
else:
|
else:
|
||||||
|
@ -948,21 +949,19 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
|
|
||||||
curve = self._graphics[graphics_name]
|
curve = self._graphics[graphics_name]
|
||||||
|
|
||||||
if len(array):
|
# NOTE: back when we weren't implementing the curve graphics
|
||||||
# TODO: we should instead implement a diff based
|
# ourselves you'd have updates using this method:
|
||||||
# "only update with new items" on the pg.PlotCurveItem
|
# curve.setData(y=array[graphics_name], x=array['index'], **kwargs)
|
||||||
# one place to dig around this might be the `QBackingStore`
|
|
||||||
# https://doc.qt.io/qt-5/qbackingstore.html
|
|
||||||
|
|
||||||
# NOTE: back when we weren't implementing the curve graphics
|
# NOTE: graphics **must** implement a diff based update
|
||||||
# ourselves you'd have updates using this method:
|
# operation where an internal ``FastUpdateCurve._xrange`` is
|
||||||
# curve.setData(y=array[graphics_name], x=array['index'], **kwargs)
|
# used to determine if the underlying path needs to be
|
||||||
|
# pre/ap-pended.
|
||||||
curve.update_from_array(
|
curve.update_from_array(
|
||||||
x=array['index'],
|
x=array['index'],
|
||||||
y=array[data_key],
|
y=array[data_key],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
return curve
|
return curve
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue