diff options
| author | 周传福 <[email protected]> | 2019-05-16 12:22:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-16 12:22:53 +0800 |
| commit | 9329b62beff829b7e6fcfe285b4267011e6f4d5c (patch) | |
| tree | 5de4f47d6267a119bd9125c41a3f882c0a8b7b70 /src/cpu.c | |
| parent | b844496ac9459a16044abe13785b355853526304 (diff) | |
| parent | 4539172f5c97306a322ac1768c5c8eb4f878ea3c (diff) | |
Merge branch 'master' into stm32_uart_tx_dma
Diffstat (limited to 'src/cpu.c')
| -rw-r--r-- | src/cpu.c | 10 |
1 files changed, 8 insertions, 2 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); |
