热门

最新

红包

立Flag

投票

同城

我的

发布
tschome
Van.Ghylivan
3 年前
truetschome

哎,嵌入式要学的东西可真多

保持热爱共赴山海
CSDN App 扫码分享
分享
评论
2
打赏
  • 复制链接
  • 举报
下一条:
voidlock_ acquire (struct lock *lock)struct thread *current_ thread = thread_ current ();struct lock *l;enum intr, level old_ level;ASSERT (lock != NULL);ASSERT (!intr_ context ( ) ;ASSERT (!1ock_ held _by_ current_ thread (lock));//-new-if (lock->holder != NULL && !thread_ mlfqs)current_ thread->lock_ _waiting = lock;1 = lock;11 kLFil 1HH18while (1 && current_ thread->priority , 1->max_ priority)f1->max_ priority = current_ thread- >priority;thread_ _donate_ priority (l->holder);1 = l->holder->lock_ _waiting;//Pf/FZ iALHi11H4sema_ down ( &lock- >semaphore) ;old_ level = intr_ disable ( );current_ thread = thread_ current ();if (!thread_ mlfqs)current_ thread->lock_ _waiting = NULL;lock->max_ priority = current_ thread- »priority;//被唤醒之后让该线程成为这个锁的持有者thread_ hold_ the_ lock (lock);lock->holder = current_ thread;intr_ set_ level (old_ level);CSDN @Polal
立即登录