-
Notifications
You must be signed in to change notification settings - Fork 215
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
Fix #642, synchronous task delete on POSIX #676
Fix #642, synchronous task delete on POSIX #676
Conversation
Only marked as draft because it requires a baseline which is not yet in |
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
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. |
* 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 |
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.
typo
@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. |
I have fixed the issues on VxWorks related to this and also broke it up into smaller commits. |
Should be CFE_MISSION_SPACECRAFT_ID
Fix nasa#676, reference to deprecated CFE_SPACECRAFT_ID
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.