Skip to content
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

Add CAT_STATUS_AGAIN to report io::[write|read] can't send or receive more data #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xiaoxiang781216
Copy link
Contributor

No description provided.

@marcinbor85
Copy link
Owner

The main idea behind returning BUSY state when can't send out character is related with sleep and low power modes. The main service function should return OK only when there is nothing to do (no pending read/write characters, no pending operations, and etc...). Many applications and projects use it so this is not backward-compatible change.

@xiaoxiang781216
Copy link
Contributor Author

The main idea behind returning BUSY state when can't send out character is related with sleep and low power modes. The main service function should return OK only when there is nothing to do (no pending read/write characters, no pending operations, and etc...). Many applications and projects use it so this is not backward-compatible change.

The return from cat_io_interface::write doesn't equal to 1 mean that the low level can't accept more character(e.g. when fd is set to non-blocking mode, write will return -EAGAIN in this case). Application need to know this state to avoid the busy loop.

@marcinbor85
Copy link
Owner

So maybe it should return BUSY_WRITE (add new state) to distinguish this state from BUSY and OK ?

… more data

Signed-off-by: Xiang Xiao <[email protected]>
Change-Id: I1e4d69dc32ef94dd2d6d64086528096340f5c74a
@xiaoxiang781216
Copy link
Contributor Author

So maybe it should return BUSY_WRITE (add new state) to distinguish this state from BUSY and OK ?

Add CAT_STATUS_AGAIN(mimic non blocking io return AGAIN) to indicate this situation.

@xiaoxiang781216 xiaoxiang781216 changed the title Should return CAT_STATUS_OK if io::write can't send out the character Add CAT_STATUS_AGAIN to report io::[write|read] can't send or receive more data Aug 27, 2022
@marcinbor85
Copy link
Owner

So now, in which case the main service function will return OK instead of BUSY or AGAIN?
This change needs to fix tests also, because the logic will change.

@xiaoxiang781216
Copy link
Contributor Author

Yes, I will find time to ensure all test pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants