修改了部分笔误
This commit is contained in:
parent
6d0d5cb163
commit
8240e3040e
|
@ -952,7 +952,7 @@ produce..produce..consume..consume..produce..consume..produce..consume..produce.
|
|||
|
||||
```java
|
||||
public class ForkJoinExample extends RecursiveTask<Integer> {
|
||||
private final int threhold = 5;
|
||||
private final int threshold = 5;
|
||||
private int first;
|
||||
private int last;
|
||||
|
||||
|
@ -964,7 +964,7 @@ public class ForkJoinExample extends RecursiveTask<Integer> {
|
|||
@Override
|
||||
protected Integer compute() {
|
||||
int result = 0;
|
||||
if (last - first <= threhold) {
|
||||
if (last - first <= threshold) {
|
||||
// 任务足够小则直接计算
|
||||
for (int i = first; i <= last; i++) {
|
||||
result += i;
|
||||
|
|
|
@ -352,7 +352,7 @@ end monitor;
|
|||
|
||||
管程引入了 **条件变量** 以及相关的操作:**wait()** 和 **signal()** 来实现同步操作。对条件变量执行 wait() 操作会导致调用进程阻塞,把管程让出来给另一个进程持有。signal() 操作用于唤醒被阻塞的进程。
|
||||
|
||||
<font size=3> **使用管程实现生成者-消费者问题** </font><br>
|
||||
<font size=3> **使用管程实现生产者-消费者问题** </font><br>
|
||||
|
||||
```pascal
|
||||
// 管程
|
||||
|
|
Loading…
Reference in New Issue
Block a user