-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Pass rt_tick_t for RT_TIMER_CTRL_SET_TIME and RT_TIMER_CTRL_GET_TIME #10717
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
Changes from all commits
9584b6d
00a0659
06a0545
df0d1dd
d1dd30a
cdf1c43
6736d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,10 +242,11 @@ static rt_err_t _comp_susp_thread(struct rt_completion *completion, | |
| /* start timer */ | ||
| if (timeout > 0) | ||
| { | ||
| rt_tick_t timeout_tick = timeout; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 涉及到内核相关的,尽量不要用c99的语法吧。局部变量的声明需要放在函数的开头。
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这也是C89语法,C89语法的意思就是,变量声明必须在
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://stackoverflow.com/a/9513651/321938 include <stdio.h>
int main()
{
int i = 22;
printf("%d\n", i);
{
int j = 42;
printf("%d\n", j);
}
return 0;
}
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我确认了下,没问题 |
||
| /* reset the timeout of thread timer and start it */ | ||
| rt_timer_control(&(thread->thread_timer), | ||
| RT_TIMER_CTRL_SET_TIME, | ||
| &timeout); | ||
| &timeout_tick); | ||
| rt_timer_start(&(thread->thread_timer)); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,10 +108,11 @@ rt_err_t rt_completion_wait_flags(struct rt_completion *completion, | |
| /* start timer */ | ||
| if (timeout > 0) | ||
| { | ||
| rt_tick_t timeout_tick = timeout; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 同上 |
||
| /* reset the timeout of thread timer and start it */ | ||
| rt_timer_control(&(thread->thread_timer), | ||
| RT_TIMER_CTRL_SET_TIME, | ||
| &timeout); | ||
| &timeout_tick); | ||
| rt_timer_start(&(thread->thread_timer)); | ||
| } | ||
| /* enable interrupt */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,10 +129,11 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, | |
| /* start timer */ | ||
| if (timeout > 0) | ||
| { | ||
| rt_tick_t timeout_tick = timeout; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 同上,麻烦一并修改 |
||
| /* reset the timeout of thread timer and start it */ | ||
| rt_timer_control(&(thread->thread_timer), | ||
| RT_TIMER_CTRL_SET_TIME, | ||
| &timeout); | ||
| &timeout_tick); | ||
| rt_timer_start(&(thread->thread_timer)); | ||
| } | ||
|
|
||
|
|
@@ -247,10 +248,11 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, | |
| /* start timer */ | ||
| if (timeout > 0) | ||
| { | ||
| rt_tick_t timeout_tick = timeout; | ||
| /* reset the timeout of thread timer and start it */ | ||
| rt_timer_control(&(thread->thread_timer), | ||
| RT_TIMER_CTRL_SET_TIME, | ||
| &timeout); | ||
| &timeout_tick); | ||
| rt_timer_start(&(thread->thread_timer)); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.