Fix #642, synchronous task delete on POSIX#676
Closed
jphickey wants to merge 1 commit intonasa:integration-candidatefrom
Closed
Fix #642, synchronous task delete on POSIX#676jphickey wants to merge 1 commit intonasa:integration-candidatefrom
jphickey wants to merge 1 commit intonasa:integration-candidatefrom
Conversation
Contributor
Author
|
Only marked as draft because it requires a baseline which is not yet in |
Contributor
|
CCB 2020-12-09 APPROVED |
2d876a5 to
938216c
Compare
In the POSIX implementation, OS_TaskDelete was implemented in a deferred manner - the API call was a request, and the actual deletion occured sometime thereafter. This is a problem if the task is running code within a dynamically loaded module, and the intent is to delete the task so the module can be unloaded. In this case the app needs to be certain that the task has actually been deleted before unloading can be done safely. To do this requires use of pthread_join() on POSIX which confirms that the task has exited. However, this is a (potentially) blocking call, so to do this requires rework of the EXCLUSIVE lock mode such that the OSAL lock is _not_ held during the join operation.
938216c to
6e03017
Compare
Contributor
Author
|
Rebased to main, and also revalidated that all platforms build and test passes. NOTE: in order to pass tests this needs #671 also merged (dependency). Without this change then OS_TaskDelete() fails. |
skliper
reviewed
Dec 11, 2020
| * a) we want to increment refcount but an exclusive is pending | ||
| * b) we want exclusive but refcount is nonzero | ||
| * c) we want exclusive but another exclusive is pending | ||
| * a) we want to some type of lock but the ID is currently RESERVED |
skliper
approved these changes
Dec 11, 2020
Contributor
Author
|
@astrogeco -- testing a preemptive merge on VxWorks and noted an issue with creating timers. May want to hold off on merging this, I will have to add a patch of some type. |
Contributor
Author
|
I have fixed the issues on VxWorks related to this and also broke it up into smaller commits. |
jphickey
added a commit
to jphickey/osal
that referenced
this pull request
Aug 10, 2022
Should be CFE_MISSION_SPACECRAFT_ID
jphickey
pushed a commit
to jphickey/osal
that referenced
this pull request
Aug 10, 2022
Fix nasa#676, reference to deprecated CFE_SPACECRAFT_ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the contribution
Make OS_TaskDelete actually wait for the task to exit, not simply a cancellation request.
Fix #642
Testing performed
Build and run CFE and all unit tests
Test the CFE "reload app" command as documented in nasa/cFE#952 which depends on having OS_TaskDelete actually exit the task
Expected behavior changes
No impact to external API/observed behavior.
Internally, the global tables are now unlocked when using an EXCLUSIVE lock type, which is used for create and delete ops. Instead of holding the global lock, the ID is set to "RESERVED" (FFFFFFFF) which effectively prevents any other task from obtaining a reference to that object. This way OSAL can more safely call C library functions which block, including (but not limited to) pthread_join, while allowing ops on other records to proceed.
System(s) tested on
Ubuntu 20.04
RTEMS 4.11
Additional context
Required as part of the fix for CFE requirement documented in nasa/cFE#952.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.