Skip to content

TCP socket semaphores changed to binary sempahore #4560

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

Closed
wants to merge 2 commits into from

Conversation

deepikabhavnani
Copy link

@deepikabhavnani deepikabhavnani commented Jun 14, 2017

Description

Data from UART can come in before we are ready for wait in receive call. Hence, semaphore release happens before it gets acquired in current implementation. As release was performed for every UART event max count (1024) was reached and as a result semaphore count error was set from RTX.

Requirement was to have a binary semaphore, allowed to perform release any times. Ignore if count is already 1.

Status

READY

Issue:
#4575

@kjbracey
Copy link
Contributor

Sounds plausible to me. But would EventFlags be a better alternative for semaphores now that CMSIS-RTOS2 is available?

Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I highly dislike trapping on error because it changes the API behavior- (instead of returning an error it trap the current thread ...) I also believe it is not acceptable to create untested workaround and special hidden rule to fix an issue in the upper layer of the OS. It just adds to the inconsistency of the platform and in the long term it is yet another special case to maintain. It has a cost and it is not negligible.

If semaphore doesn't fit the use case, switch to an appropriate thread synchronization primitive. Event Flags might be a good candidate.

@geky
Copy link
Contributor

geky commented Jun 16, 2017

Event flags are a good candidate, but we don't have a c++ api in place yet. @YarivCol has started one #4517 but it's not ready for merge yet.

Even with osEventFlags, the regression we're seeing here and in other modules is alarming. I created a general pr that restores the original behaviour here #4579, if that is merged we can also take in the *Socket.cpp changes in @deepikabhavnani's patch to remove the extra cycles spining on the semaphore.

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.

6 participants