-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature req: DataOutputQueue
with maxSize=0
--> received data only sent to callbacks
#366
Comments
While updating the code, those same two
Then for both cases, it is possible for one thread to be "on the path" to destruct the class instance while another thread is calling In the two However, there is not 👎 sufficient locking anywhere to prevent, e.g., Adding those frames to the Queue won't crash. Instead, it is useless work. 😵 The 6 lines of I recommend removing all 6 of those |
DataOutputQueue
with maxSize=0
--> therefore received data is only sent to callbacksDataOutputQueue
with maxSize=0
--> received data only sent to callbacks
I agree with the proposed. Also +1 on the maxSize=0 behavior. One alternative to this was to have one callback overtake the queuing mechanism - by having a Thoughts on above compared with or inline with maxSize = 0? |
Edit on above - addCallback is also being used internally, so good on only going with maxSize=0 approach instead:) |
- minor optimize LockingQueue - fixes luxonis#366
I request the
DataOutputQueue
supportmaxSize=0
so that no data is retained in the internalstd::queue
yet the callbacks continue to be called with the data.I think the change is trivial and isolated to
LockingQueue.hpp
. I can take on this work as it already has use potential in my app.Setup
Repro
By code review.
LockingQueue::push()
andtryWaitAndPush()
don't behave appropriately when maxSize=0.If maxSize=0, they would actually behave as if it was =1.
depthai-core/include/depthai/utility/LockingQueue.hpp
Lines 107 to 125 in c2ccafd
A one-line change to check for
if (maxSize == 0) return true
would correct the behavior and support this feature request. I thinktrue
is the appropriate return since this is not an error condition and the function would have placed the data into the queue. It just so happens that a maxSize=0 queue is a singularity with size 0... or like /dev/null.And removing the one line check here
depthai-core/include/depthai/utility/LockingQueue.hpp
Line 22 in c2ccafd
The text was updated successfully, but these errors were encountered: