-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
proposal to fix regression in 4c9fcf86651232c2104b57510a0ac86cf86123e4 #1057
Conversation
Can you describe the regression in more detail, please? |
I will try to provide a C example, but using python examples example2.py or example3.py from #1058 exhibit the behaviour. from the waiting loop after transfer callback has been launched.
|
Here is a minimal C example that can be used to reproduce: output without PR is :
which shows that is_streaming keeps returning true long after transfer is actually finished. While with patched PR the wait loop exit correctly :
by the way, I also noticed the block :
right above the PR commit, that probably needs adding a |
Hello, did you had time to review/reproduce the issue and test the proposed patch ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Matioupi, thanks for reporting the issue and making this PR. I've reproduced the issue using your C program, which was very helpful.
I think your fix is correct, but it took me a while to understand how and why this line ended up being needed:
-
The problem crept in via PR Fixes for concurrency bugs in start/stop operations #1029, which removed the
request_exit()
call after the callback returns nonzero, and replaced it withtransfer_finished()
- I did this because we don't want to make the transfer thread exit until all the transfer cancellations are complete. -
I was confused how this caused a problem with the
streaming
flag, because therequest_exit()
function doesn't touch thestreaming
flag, it only setsdo_exit
. -
But
hackrf_is_streaming()
checks bothstreaming
anddo_exit
, and it turns out it was depending ondo_exit
being set in order to returnfalse
in this particular scenario: when transfers are stopping because the RX callback has returned nonzero, yethackrf_stop_rx()
has not been called yet. -
So in order to maintain the behaviour of
hackrf_is_streaming()
, we need to clear thestreaming
flag here instead of settingdo_exit
.
So I'm happy with the fix, but I do have a request before merging it: could you please rebase this branch to include just the commit with the fix. At the moment it includes several unrelated commits which are then undone later.
If If |
31b73b4
to
8fae12d
Compare
see : 4c9fcf8#r68042495
only 25f0d58 is actually requiered.