close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_repos.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Jan 16, 2009, 5:20:48 PM (16 years ago)
- Author:
-
wade
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v9
|
v10
|
|
87 | 87 | * 由於 FD 是 file descriptor, 非 file stream。所以為法使用 fread 和 fwrite。要使用 read 和 write 函式。 |
88 | 88 | * read() 會被 block 住,所以不用擔心 parent 會比 child 先結束,而導致 child 也跟著結束 (因為 child process 是依附著 parent process 而存在,依存關係可透過 pstree 查詢)。 |
89 | | * 先使用 pipe(FD[2]),再使用 fork() 時,FD[2] 也會同時複製兩份,child 跟 parent 有各自的 FD[0]、FD[1],所以要記得關掉不必要的 FD ,兩個 processes 各自與 pipe 相接。 |
| 89 | * 先使用 pipe(FD[2]),再使用 fork() 時,FD[2] 也會同時複製兩份,child 跟 parent 有各自的 FD[0]、FD[1],所以要記得關掉不必要的 FD ,兩個 processes 各自與 pipe 相接。[[BR]][[BR]] |
90 | 90 | * 範例:pipe2.c |
91 | 91 | {{{ |