You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re: @wallaroo implement thread safe fifo ring buffer
Ya, that could definitely be an issue, although I'm not sure what the use case would be for multiple threads/requests attempting to read. For the most part the top two choices now are:
listener (which won't have this issue)
interval (which again should only be firing once at a time)
I'm not sure the case where multiple concurrent reads will happen, at least in how my company uses this. I think the more appropriate way from a React Native standpoint is to have listener or interval updating the scope/context and having multiple > screens/processes read from the scope/context.
I'm more worried about a Buffer Overflow exception when there is no listener at this point.
i'm worried about receiving data (buffer write) in the DeviceConnection Thread during a read in the React thread...
a threadsafe fifo ring buffer should be safer...
Right now the BufferSize is READ_SIZE (1024) which is also the individual read request size. So it's possible that after a single read the buffer could be full if there is no listener.
Although I'm unsure what the standard should be?
BufferSize = READ_SIZE * X???
even with this, if no listener the buffer could overflow
The only other option is before adding to the buffer check how much there is
Fill from current to end
reset to start
rewrite the remaining over the start
I don't have nearly enough experience with managing buffers and streaming data to know if that's an acceptable choice.
i'm thinking about a serial comm .... the rx buffer is a circular fifo buffer: the producer writes the head, the consumer reads the tail... if the producer completes the the free space it silently overwrite unread tail data...
The text was updated successfully, but these errors were encountered:
ByteArrayDeviceConnection:
Re: @wallaroo implement thread safe fifo ring buffer
Ya, that could definitely be an issue, although I'm not sure what the use case would be for multiple threads/requests attempting to read. For the most part the top two choices now are:
i'm worried about receiving data (buffer write) in the DeviceConnection Thread during a read in the React thread...
a threadsafe fifo ring buffer should be safer...
i'm thinking about a serial comm .... the rx buffer is a circular fifo buffer: the producer writes the head, the consumer reads the tail... if the producer completes the the free space it silently overwrite unread tail data...
The text was updated successfully, but these errors were encountered: