File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,16 @@ rt_base_t rt_cpus_lock(void)
4242 pcpu = rt_cpu_self ();
4343 if (pcpu -> current_thread != RT_NULL )
4444 {
45- if (pcpu -> current_thread -> cpus_lock_nest ++ == 0 )
45+ register rt_uint16_t lock_nest = pcpu -> current_thread -> cpus_lock_nest ;
46+
47+ pcpu -> current_thread -> cpus_lock_nest ++ ;
48+ if (lock_nest == 0 )
4649 {
4750 pcpu -> current_thread -> scheduler_lock_nest ++ ;
4851 rt_hw_spin_lock (& _cpus_lock );
4952 }
5053 }
54+
5155 return level ;
5256}
5357RTM_EXPORT (rt_cpus_lock );
@@ -61,7 +65,9 @@ void rt_cpus_unlock(rt_base_t level)
6165
6266 if (pcpu -> current_thread != RT_NULL )
6367 {
64- if (-- pcpu -> current_thread -> cpus_lock_nest == 0 )
68+ pcpu -> current_thread -> cpus_lock_nest -- ;
69+
70+ if (pcpu -> current_thread -> cpus_lock_nest == 0 )
6571 {
6672 pcpu -> current_thread -> scheduler_lock_nest -- ;
6773 rt_hw_spin_unlock (& _cpus_lock );
You can’t perform that action at this time.
0 commit comments