From 6a824124551ecb008d9c6831fbd2a195b4cb0cd8 Mon Sep 17 00:00:00 2001 From: lqhao <39197200+Awakeyoyoyo@users.noreply.github.com> Date: Sun, 5 Jan 2020 14:50:50 +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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notes/计算机操作系统 - 进程管理.md b/notes/计算机操作系统 - 进程管理.md index 51a2bada..8c5b5a1e 100644 --- a/notes/计算机操作系统 - 进程管理.md +++ b/notes/计算机操作系统 - 进程管理.md @@ -384,6 +384,13 @@ void check(i) { up(&s[i]); } } + +void think(int i) { + down(&mutex); + state[i] = HUNGRY; + up(&mutex); +} + ``` ## 2. 读者-写者问题