Merge pull request #3762 from DavidLin1577/patch-5

Minor optimization for mempool.c
This commit is contained in:
Bernard Xiong 2020-07-24 07:29:05 +08:00 committed by GitHub
commit a88c819139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -134,7 +134,7 @@ RTM_EXPORT(rt_mp_init);
rt_err_t rt_mp_detach(struct rt_mempool *mp)
{
struct rt_thread *thread;
register rt_ubase_t temp;
register rt_ubase_t level;
/* parameter check */
RT_ASSERT(mp != RT_NULL);
@ -145,7 +145,7 @@ rt_err_t rt_mp_detach(struct rt_mempool *mp)
while (!rt_list_isempty(&(mp->suspend_thread)))
{
/* disable interrupt */
temp = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
/* get next suspend thread */
thread = rt_list_entry(mp->suspend_thread.next, struct rt_thread, tlist);
@ -160,7 +160,7 @@ rt_err_t rt_mp_detach(struct rt_mempool *mp)
rt_thread_resume(thread);
/* enable interrupt */
rt_hw_interrupt_enable(temp);
rt_hw_interrupt_enable(level);
}
/* detach object */
@ -250,7 +250,7 @@ RTM_EXPORT(rt_mp_create);
rt_err_t rt_mp_delete(rt_mp_t mp)
{
struct rt_thread *thread;
register rt_ubase_t temp;
register rt_ubase_t level;
RT_DEBUG_NOT_IN_INTERRUPT;
@ -263,7 +263,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
while (!rt_list_isempty(&(mp->suspend_thread)))
{
/* disable interrupt */
temp = rt_hw_interrupt_disable();
level = rt_hw_interrupt_disable();
/* get next suspend thread */
thread = rt_list_entry(mp->suspend_thread.next, struct rt_thread, tlist);
@ -278,7 +278,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
rt_thread_resume(thread);
/* enable interrupt */
rt_hw_interrupt_enable(temp);
rt_hw_interrupt_enable(level);
}
/* release allocated room */