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

Update mutex and condition-variable interface #3158

Open
wants to merge 9 commits into
base: devel
Choose a base branch
from

Conversation

kevin-f-ortega
Copy link
Collaborator

Related Issue(s) #2959
Has Unit Tests (y/n) y
Documentation Included (y/n) y

Change Description

Updated ConditionVariable wait API to pend with a return status.

Rationale

Originally, the F Prime ConditionVariable wait function was locking the mutex. This led to double locking the mutex because the underlying OS' ConditionalVariable wait library call was also locking the mutex. This is an issue because we only do a single unlock.

Testing/Review Recommendations

Run UTs, run CI and nominal FIT tests.

Future Work

PosixMutexHandle* mutex_handle = reinterpret_cast<PosixMutexHandle*>(mutex.getHandle());
FW_ASSERT(pthread_cond_wait(&this->m_handle.m_condition, &mutex_handle->m_mutex_descriptor) == 0);
PlatformIntType status = pthread_cond_wait(&this->m_handle.m_condition, &mutex_handle->m_mutex_descriptor);

Check notice

Code scanning / CodeQL

Use of basic integral type Note

status uses the basic integral type int rather than a typedef with size and signedness.
@@ -184,5 +184,21 @@
}
return status;
}

ConditionVariable::Status posix_status_to_conditional_status(PlatformIntType posix_status) {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

posix_status uses the basic integral type int rather than a typedef with size and signedness.
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.

1 participant