diff options
| author | Bernard Xiong <[email protected]> | 2019-05-09 12:57:47 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-09 12:57:47 +0800 |
| commit | 2bf9ba0675dd7a6ab84f79abf2abfd8096710013 (patch) | |
| tree | 70d1a96ac794a686007dbdcbfb10537dcf5fbc5b /src | |
| parent | fa2d77ac72533f4b8bdcbdd4a48a562abe525edd (diff) | |
| parent | 43c1236ec9fd0d8530714370b7a664efd6d9bf3a (diff) | |
Merge pull request #2661 from BernardXiong/pre-release_v4.0.1
Pre-release for v4.0.1
Diffstat (limited to 'src')
| -rw-r--r-- | src/cpu.c | 10 | ||||
| -rw-r--r-- | src/ipc.c | 4 |
2 files changed, 10 insertions, 4 deletions
@@ -42,12 +42,16 @@ rt_base_t rt_cpus_lock(void) pcpu = rt_cpu_self(); if (pcpu->current_thread != RT_NULL) { - if (pcpu->current_thread->cpus_lock_nest++ == 0) + register rt_uint16_t lock_nest = pcpu->current_thread->cpus_lock_nest; + + pcpu->current_thread->cpus_lock_nest++; + if (lock_nest == 0) { pcpu->current_thread->scheduler_lock_nest++; rt_hw_spin_lock(&_cpus_lock); } } + return level; } RTM_EXPORT(rt_cpus_lock); @@ -61,7 +65,9 @@ void rt_cpus_unlock(rt_base_t level) if (pcpu->current_thread != RT_NULL) { - if (--pcpu->current_thread->cpus_lock_nest == 0) + pcpu->current_thread->cpus_lock_nest--; + + if (pcpu->current_thread->cpus_lock_nest == 0) { pcpu->current_thread->scheduler_lock_nest--; rt_hw_spin_unlock(&_cpus_lock); @@ -753,8 +753,8 @@ __again: if (thread->error != RT_EOK) { - /* interrupt by signal, try it again */ - if (thread->error == -RT_EINTR) goto __again; + /* interrupt by signal, try it again */ + if (thread->error == -RT_EINTR) goto __again; /* return error */ return thread->error; |
