Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
f2f062da
提交
f2f062da
8月 08, 2007
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
check p->killed for long-lived sleeps
上级
1cb183a9
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
10 行增加
和
4 行删除
+10
-4
console.c
console.c
+7
-1
pipe.c
pipe.c
+2
-2
proc.c
proc.c
+1
-1
没有找到文件。
console.c
浏览文件 @
f2f062da
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "dev.h"
#include "dev.h"
#include "param.h"
#include "param.h"
#include "mmu.h"
#include "mmu.h"
#include "proc.h"
struct
spinlock
console_lock
;
struct
spinlock
console_lock
;
int
panicked
=
0
;
int
panicked
=
0
;
...
@@ -395,8 +396,13 @@ console_read(int minor, char *dst, int n)
...
@@ -395,8 +396,13 @@ console_read(int minor, char *dst, int n)
target
=
n
;
target
=
n
;
acquire
(
&
kbd_lock
);
acquire
(
&
kbd_lock
);
while
(
n
>
0
){
while
(
n
>
0
){
while
(
kbd_r
==
kbd_w
)
while
(
kbd_r
==
kbd_w
){
if
(
curproc
[
cpu
()]
->
killed
){
release
(
&
kbd_lock
);
return
-
1
;
}
sleep
(
&
kbd_r
,
&
kbd_lock
);
sleep
(
&
kbd_r
,
&
kbd_lock
);
}
c
=
kbd_buf
[
kbd_r
++
];
c
=
kbd_buf
[
kbd_r
++
];
if
(
c
==
C
(
'D'
)){
// EOF
if
(
c
==
C
(
'D'
)){
// EOF
if
(
n
<
target
){
if
(
n
<
target
){
...
...
pipe.c
浏览文件 @
f2f062da
...
@@ -86,7 +86,7 @@ pipe_write(struct pipe *p, char *addr, int n)
...
@@ -86,7 +86,7 @@ pipe_write(struct pipe *p, char *addr, int n)
for
(
i
=
0
;
i
<
n
;
i
++
){
for
(
i
=
0
;
i
<
n
;
i
++
){
while
(((
p
->
writep
+
1
)
%
PIPESIZE
)
==
p
->
readp
){
while
(((
p
->
writep
+
1
)
%
PIPESIZE
)
==
p
->
readp
){
if
(
p
->
readopen
==
0
){
if
(
p
->
readopen
==
0
||
curproc
[
cpu
()]
->
killed
){
release
(
&
p
->
lock
);
release
(
&
p
->
lock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -110,7 +110,7 @@ pipe_read(struct pipe *p, char *addr, int n)
...
@@ -110,7 +110,7 @@ pipe_read(struct pipe *p, char *addr, int n)
acquire
(
&
p
->
lock
);
acquire
(
&
p
->
lock
);
while
(
p
->
readp
==
p
->
writep
){
while
(
p
->
readp
==
p
->
writep
){
if
(
p
->
writeopen
==
0
){
if
(
p
->
writeopen
==
0
||
curproc
[
cpu
()]
->
killed
){
release
(
&
p
->
lock
);
release
(
&
p
->
lock
);
return
0
;
return
0
;
}
}
...
...
proc.c
浏览文件 @
f2f062da
...
@@ -405,7 +405,7 @@ proc_wait(void)
...
@@ -405,7 +405,7 @@ proc_wait(void)
}
}
// No point waiting if we don't have any children.
// No point waiting if we don't have any children.
if
(
!
havekids
){
if
(
!
havekids
||
cp
->
killed
){
release
(
&
proc_table_lock
);
release
(
&
proc_table_lock
);
return
-
1
;
return
-
1
;
}
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论