-
Notifications
You must be signed in to change notification settings - Fork 5.2k
add RT_DEBUG_SCHEDULER_AVAILABLE check. #4740
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,6 +485,9 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time) | |
RT_ASSERT(sem != RT_NULL); | ||
RT_ASSERT(rt_object_get_type(&sem->parent.parent) == RT_Object_Class_Semaphore); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(time != 0); | ||
|
||
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(sem->parent.parent))); | ||
|
||
/* disable interrupt */ | ||
|
@@ -514,9 +517,6 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time) | |
} | ||
else | ||
{ | ||
/* current context checking */ | ||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
|
||
/* semaphore is unavailable, push to suspend list */ | ||
/* get current thread */ | ||
thread = rt_thread_self(); | ||
|
@@ -912,7 +912,8 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) | |
struct rt_thread *thread; | ||
|
||
/* this function must not be used in interrupt even if time = 0 */ | ||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE); | ||
|
||
/* parameter check */ | ||
RT_ASSERT(mutex != RT_NULL); | ||
|
@@ -1566,12 +1567,13 @@ rt_err_t rt_event_recv(rt_event_t event, | |
register rt_ubase_t level; | ||
register rt_base_t status; | ||
|
||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
|
||
/* parameter check */ | ||
RT_ASSERT(event != RT_NULL); | ||
RT_ASSERT(rt_object_get_type(&event->parent.parent) == RT_Object_Class_Event); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE); | ||
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. 郭老师,这个位置是RT_TRUE还是timeout != 0 |
||
|
||
if (set == 0) | ||
return -RT_ERROR; | ||
|
||
|
@@ -1993,6 +1995,9 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, | |
RT_ASSERT(mb != RT_NULL); | ||
RT_ASSERT(rt_object_get_type(&mb->parent.parent) == RT_Object_Class_MailBox); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0); | ||
|
||
/* initialize delta tick */ | ||
tick_delta = 0; | ||
/* get current thread */ | ||
|
@@ -2025,7 +2030,6 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, | |
return -RT_EFULL; | ||
} | ||
|
||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
/* suspend current thread */ | ||
_ipc_list_suspend(&(mb->suspend_sender_thread), | ||
thread, | ||
|
@@ -2236,6 +2240,9 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout) | |
RT_ASSERT(mb != RT_NULL); | ||
RT_ASSERT(rt_object_get_type(&mb->parent.parent) == RT_Object_Class_MailBox); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0); | ||
|
||
/* initialize delta tick */ | ||
tick_delta = 0; | ||
/* get current thread */ | ||
|
@@ -2271,7 +2278,6 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout) | |
return -RT_ETIMEOUT; | ||
} | ||
|
||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
/* suspend current thread */ | ||
_ipc_list_suspend(&(mb->parent.suspend_thread), | ||
thread, | ||
|
@@ -2744,6 +2750,9 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq, | |
RT_ASSERT(buffer != RT_NULL); | ||
RT_ASSERT(size != 0); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0); | ||
|
||
/* greater than one message size */ | ||
if (size > mq->msg_size) | ||
return -RT_ERROR; | ||
|
@@ -2784,7 +2793,6 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq, | |
return -RT_EFULL; | ||
} | ||
|
||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
/* suspend current thread */ | ||
_ipc_list_suspend(&(mq->suspend_sender_thread), | ||
thread, | ||
|
@@ -3054,6 +3062,9 @@ rt_err_t rt_mq_recv(rt_mq_t mq, | |
RT_ASSERT(buffer != RT_NULL); | ||
RT_ASSERT(size != 0); | ||
|
||
/* current context checking */ | ||
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0); | ||
|
||
/* initialize delta tick */ | ||
tick_delta = 0; | ||
/* get current thread */ | ||
|
@@ -3074,8 +3085,6 @@ rt_err_t rt_mq_recv(rt_mq_t mq, | |
/* message queue is empty */ | ||
while (mq->entry == 0) | ||
{ | ||
RT_DEBUG_IN_THREAD_CONTEXT; | ||
|
||
/* reset error number in thread */ | ||
thread->error = RT_EOK; | ||
|
||
|
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.
Uh oh!
There was an error while loading. Please reload this page.