Skip to content

Commit bbed3ed

Browse files
committed
update signal
1 parent 57e2566 commit bbed3ed

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

1.14/signal_based_preemption.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,35 @@ sigaction 的三个参数:
137137
goto 虽然看起来无所不能,但实际上高级语言的 goto 是跳不出函数作用域的,比如下面这样的代码就没法通过编译:
138138

139139
```go
140-
TODO
140+
package main
141+
142+
func xx() {
143+
xx:
144+
}
145+
146+
func main() {
147+
goto yy
148+
goto xx
149+
yy:
150+
}
141151
```
142152

153+
goto yy,没有问题,但是 goto xx 是不行的。
154+
143155
在其它语言里也一样:
144156

145157
```c
146-
TODO
158+
#include <stdio.h>
159+
160+
void xx() {
161+
XX:
162+
printf("hello world");
163+
}
164+
165+
int main() {
166+
goto XX;
167+
return 0;
168+
}
147169
```
148170

149171
### non-local goto

0 commit comments

Comments
 (0)