From baa5d0483744d3f895711adccfe21a4b39702730 Mon Sep 17 00:00:00 2001 From: lqhao <39197200+Awakeyoyoyo@users.noreply.github.com> Date: Sun, 5 Jan 2020 14:59:33 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E8=AE=A1=E7=AE=97=E6=9C=BA=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E7=B3=BB=E7=BB=9F=20-=20=E8=BF=9B=E7=A8=8B=E7=AE=A1?= =?UTF-8?q?=E7=90=86.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 进程管理-哲学家进餐问题列出的代码 少了一个think函数 --- notes/计算机操作系统 - 进程管理.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notes/计算机操作系统 - 进程管理.md b/notes/计算机操作系统 - 进程管理.md index 51a2bada..1dae1322 100644 --- a/notes/计算机操作系统 - 进程管理.md +++ b/notes/计算机操作系统 - 进程管理.md @@ -384,6 +384,11 @@ void check(i) { up(&s[i]); } } +void think(int i) { + down(&mutex); + state[i] = HUNGRY; + up(&mutex); +} ``` ## 2. 读者-写者问题