diff options
| author | Meco Man <[email protected]> | 2020-11-21 16:23:43 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-21 16:23:43 +0800 |
| commit | 3634621815b4145c786cff2e22cfeae5b108e94f (patch) | |
| tree | 0bfa64046729fd05e7b6688d1966bc7f7d0f1bae /src | |
| parent | 7d0b8341998666fe0330ada8cbfdd9572579d046 (diff) | |
| parent | 9dc0bbb814dff797eabb1cbcc133410c75471cd0 (diff) | |
Merge pull request #2 from RT-Thread/master
update
Diffstat (limited to 'src')
| -rw-r--r-- | src/SConscript | 4 | ||||
| -rw-r--r-- | src/kservice.c | 6 | ||||
| -rw-r--r-- | src/memheap.c | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/SConscript b/src/SConscript index 82c3b8aaf1..c03d997cd1 100644 --- a/src/SConscript +++ b/src/SConscript @@ -29,6 +29,8 @@ if GetDepend('RT_USING_DEVICE') == False: if GetDepend('RT_USING_SMP') == False: SrcRemove(src, ['cpu.c']) -group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH) +CPPDEFINES = ['__RTTHREAD__'] + +group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) Return('group') diff --git a/src/kservice.c b/src/kservice.c index 7caf43ce28..0a74f05268 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1116,7 +1116,7 @@ RTM_EXPORT(rt_console_get_device); * * @param name the name of new console device * - * @return the old console device handler + * @return the old console device handler on successful, or RT_NULL on failure. */ rt_device_t rt_console_set_device(const char *name) { @@ -1127,6 +1127,10 @@ rt_device_t rt_console_set_device(const char *name) /* find new console device */ new_device = rt_device_find(name); + + /* check whether it's a same device */ + if (new_device == old_device) return RT_NULL; + if (new_device != RT_NULL) { if (_console_device != RT_NULL) diff --git a/src/memheap.c b/src/memheap.c index aef56e1a74..0ff6925696 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -126,8 +126,8 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap) RT_ASSERT(heap); RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap); RT_ASSERT(rt_object_is_systemobject(&heap->parent)); - - rt_object_detach(&(heap->lock.parent.parent)); + + rt_sem_detach(&heap->lock); rt_object_detach(&(heap->parent)); /* Return a successful completion. */ |
