Skip to content

Removed the initialization caller check from the timer change service, so tx_timer_change can now be called from tx_application_define like the other timer services - #730

Open
fdesbiens wants to merge 1 commit into
eclipse-threadx:devfrom
fdesbiens:fix/issue-224

Conversation

@fdesbiens

Copy link
Copy Markdown
Contributor

_txe_timer_change returned TX_CALLER_ERROR for any call made while the system state was TX_INITIALIZE_IN_PROGRESS or above, so tx_timer_change was the only timer service that could not be called from tx_application_define. tx_timer_create, tx_timer_activate and tx_timer_deactivate are all allowed there, and tx_timer_change was even allowed from an ISR, so the restriction was inconsistent as well as undocumented in its rationale.

The check has no technical basis. _tx_timer_change only writes the expiration fields of a timer that is not on an active list, and it does so with interrupts disabled, so calling it during initialization is exactly as safe as calling it from a thread. Applications that needed it had to build with TX_DISABLE_ERROR_CHECKING or patch the check out locally.

This removes the check from both the common and the common_smp copies of txe_timer_change.c, drops the now unused tx_initialize.h and tx_thread.h includes and the TX_CALLER_ERROR entry in the function header comment, and adds an initialization-time tx_timer_change call to testcontrol.c in both regression suites so the behaviour is covered by the timer simple test.

Relaxing an error check is backward compatible: no correct application depends on receiving TX_CALLER_ERROR here.

Verified that the new check fails on dev (ERROR #30) and passes with the fix. Both suites are green: 116/116 SMP, 103/103 non-SMP.

Fixes #224

…, so tx_timer_change can now be called from tx_application_define like the other timer services

_txe_timer_change rejected any call made while the system state was
TX_INITIALIZE_IN_PROGRESS or above, which made the timer API
inconsistent: tx_timer_create, tx_timer_activate and tx_timer_deactivate
are all callable from initialization, and tx_timer_change was callable
from an ISR but not from tx_application_define.

The restriction had no technical basis. _tx_timer_change only writes the
expiration fields of a timer that is not on an active list, and it does
so with interrupts disabled, so calling it during initialization is as
safe as calling it from a thread. Applications that needed this had to
either build with TX_DISABLE_ERROR_CHECKING or patch the check out.

Dropped the check in both the common and the common_smp copies, removed
the now unused tx_initialize.h and tx_thread.h includes along with the
TX_CALLER_ERROR entry in the function header, and added an
initialization time tx_timer_change call to the regression test control
code so the behaviour is covered by the timer simple test in both
suites.

Fixes eclipse-threadx#224

Assisted-by: Copilot (Opus 5) <noreply@github.com>
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