MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_cpus_unlock

Function rt_cpus_unlock

src/cpu_mp.c:206–231  ·  view source on GitHub ↗

* @brief This function will restore all cpus's scheduler and restore local irq. * * @param level is interrupt status returned by rt_cpus_lock(). * * @note This function only has MP version. */

Source from the content-addressed store, hash-verified

204 * @note This function only has MP version.
205 */
206void rt_cpus_unlock(rt_base_t level)
207{
208 struct rt_cpu* pcpu = rt_cpu_self();
209
210 if (pcpu->current_thread != RT_NULL)
211 {
212 rt_base_t critical_level = 0;
213 RT_ASSERT(rt_atomic_load(&(pcpu->current_thread->cpus_lock_nest)) > 0);
214 rt_atomic_sub(&(pcpu->current_thread->cpus_lock_nest), 1);
215
216 if (pcpu->current_thread->cpus_lock_nest == 0)
217 {
218#if defined(RT_DEBUGING_SPINLOCK)
219 _cpus_lock_owner = __OWNER_MAGIC;
220 _cpus_lock_pc = RT_NULL;
221#endif /* RT_DEBUGING_SPINLOCK */
222#ifdef RT_USING_DEBUG
223 critical_level = _cpus_critical_level;
224 _cpus_critical_level = 0;
225#endif /* RT_USING_DEBUG */
226 rt_hw_spin_unlock(&_cpus_lock);
227 rt_exit_critical_safe(critical_level);
228 }
229 }
230 rt_hw_local_irq_enable(level);
231}
232RTM_EXPORT(rt_cpus_unlock);
233
234/**

Callers 4

demo_core_threadFunction · 0.85
core_threadFunction · 0.85
demo_core_threadFunction · 0.85
demo_core_threadFunction · 0.85

Calls 3

rt_cpu_selfFunction · 0.70
rt_exit_critical_safeFunction · 0.70
rt_hw_spin_unlockFunction · 0.50

Tested by 1

core_threadFunction · 0.68