Skip to content

Commit f84b140

Browse files
committed
auto commit
1 parent 5f005e2 commit f84b140

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

docs/notes/Java 并发.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,23 @@
6868
- 实现 Callable 接口;
6969
- 继承 Thread 类。
7070

71-
实现 Runnable 和 Callable 接口的类只能当做一个可以在线程中运行的任务,不是真正意义上的线程,因此最后还需要通过 Thread 来调用。可以说任务是通过线程驱动从而执行的
71+
实现 Runnable 和 Callable 接口的类只能当做一个可以在线程中运行的任务,不是真正意义上的线程,因此最后还需要通过 Thread 来调用。可以理解为任务是通过线程驱动从而执行的
7272

7373
## 实现 Runnable 接口
7474

75-
需要实现 run() 方法。
76-
77-
通过 Thread 调用 start() 方法来启动线程。
75+
需要实现接口中的 run() 方法。
7876

7977
```java
8078
public class MyRunnable implements Runnable {
79+
@Override
8180
public void run() {
8281
// ...
8382
}
8483
}
8584
```
8685

86+
使用 Runnable 实例再创建一个 Thread 实例,然后调用 Thread 实例的 start() 方法来启动线程。
87+
8788
```java
8889
public static void main(String[] args) {
8990
MyRunnable instance = new MyRunnable();

docs/notes/Socket.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ else
208208
select 和 poll 的功能基本相同,不过在一些实现细节上有所不同。
209209

210210
- select 会修改描述符,而 poll 不会;
211-
- select 的描述符类型使用数组实现,FD_SETSIZE 大小默认为 1024,因此默认只能监听 1024 个描述符。如果要监听更多描述符的话,需要修改 FD_SETSIZE 之后重新编译;而 poll 没有描述符数量的限制;
211+
- select 的描述符类型使用数组实现,FD_SETSIZE 大小默认为 1024,因此默认只能监听少于 1024 个描述符。如果要监听更多描述符的话,需要修改 FD_SETSIZE 之后重新编译;而 poll 没有描述符数量的限制;
212212
- poll 提供了更多的事件类型,并且对描述符的重复利用上比 select 高。
213213
- 如果一个线程对某个描述符调用了 select 或者 poll,另一个线程关闭了该描述符,会导致调用结果不确定。
214214

notes/Java 并发.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,23 @@
6868
- 实现 Callable 接口;
6969
- 继承 Thread 类。
7070

71-
实现 Runnable 和 Callable 接口的类只能当做一个可以在线程中运行的任务,不是真正意义上的线程,因此最后还需要通过 Thread 来调用。可以说任务是通过线程驱动从而执行的
71+
实现 Runnable 和 Callable 接口的类只能当做一个可以在线程中运行的任务,不是真正意义上的线程,因此最后还需要通过 Thread 来调用。可以理解为任务是通过线程驱动从而执行的
7272

7373
## 实现 Runnable 接口
7474

75-
需要实现 run() 方法。
76-
77-
通过 Thread 调用 start() 方法来启动线程。
75+
需要实现接口中的 run() 方法。
7876

7977
```java
8078
public class MyRunnable implements Runnable {
79+
@Override
8180
public void run() {
8281
// ...
8382
}
8483
}
8584
```
8685

86+
使用 Runnable 实例再创建一个 Thread 实例,然后调用 Thread 实例的 start() 方法来启动线程。
87+
8788
```java
8889
public static void main(String[] args) {
8990
MyRunnable instance = new MyRunnable();

notes/Socket.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ else
208208
select 和 poll 的功能基本相同,不过在一些实现细节上有所不同。
209209

210210
- select 会修改描述符,而 poll 不会;
211-
- select 的描述符类型使用数组实现,FD_SETSIZE 大小默认为 1024,因此默认只能监听 1024 个描述符。如果要监听更多描述符的话,需要修改 FD_SETSIZE 之后重新编译;而 poll 没有描述符数量的限制;
211+
- select 的描述符类型使用数组实现,FD_SETSIZE 大小默认为 1024,因此默认只能监听少于 1024 个描述符。如果要监听更多描述符的话,需要修改 FD_SETSIZE 之后重新编译;而 poll 没有描述符数量的限制;
212212
- poll 提供了更多的事件类型,并且对描述符的重复利用上比 select 高。
213213
- 如果一个线程对某个描述符调用了 select 或者 poll,另一个线程关闭了该描述符,会导致调用结果不确定。
214214

0 commit comments

Comments
 (0)