because the sethook operation is invoked only in system initialization, the interrupt protect is removed.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1504 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
ee68988518
commit
de50381baa
17
src/mem.c
17
src/mem.c
@ -49,6 +49,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
/* #define RT_MEM_DEBUG */
|
||||
@ -72,15 +73,7 @@ static void (*rt_free_hook)(void *ptr);
|
||||
*/
|
||||
void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_malloc_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,15 +84,7 @@ void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size))
|
||||
*/
|
||||
void rt_free_sethook(void (*hook)(void *ptr))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_free_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
40
src/object.c
40
src/object.c
@ -84,15 +84,7 @@ void (*rt_object_put_hook)(struct rt_object* object);
|
||||
*/
|
||||
void rt_object_attach_sethook(void (*hook)(struct rt_object* object))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_object_attach_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,15 +95,7 @@ void rt_object_attach_sethook(void (*hook)(struct rt_object* object))
|
||||
*/
|
||||
void rt_object_detach_sethook(void (*hook)(struct rt_object* object))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_object_detach_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,15 +113,7 @@ void rt_object_detach_sethook(void (*hook)(struct rt_object* object))
|
||||
*/
|
||||
void rt_object_trytake_sethook(void (*hook)(struct rt_object* object))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_object_trytake_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,15 +132,7 @@ void rt_object_trytake_sethook(void (*hook)(struct rt_object* object))
|
||||
*/
|
||||
void rt_object_take_sethook(void (*hook)(struct rt_object* object))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_object_take_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,15 +143,7 @@ void rt_object_take_sethook(void (*hook)(struct rt_object* object))
|
||||
*/
|
||||
void rt_object_put_sethook(void (*hook)(struct rt_object* object))
|
||||
{
|
||||
register rt_base_t temp;
|
||||
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
rt_object_put_hook = hook;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(temp);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user