This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit ce2d95c
committed
Demonstrate best practice for feeding stdin of a child processes
It's possible to create a deadlock with stdin/stdout I/O on a single thread:
* the child process may fill its stdout buffer, and have to wait for the parent process to read it,
* but the parent process may be waiting until its stdin write finishes before reading the stdout.
Therefore, the parent process should use separate threads for writing and reading.1 parent 3a5d45f commit ce2d95c
1 file changed
+18
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | | - | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
1145 | 1149 | | |
1146 | 1150 | | |
1147 | 1151 | | |
1148 | | - | |
1149 | | - | |
| 1152 | + | |
| 1153 | + | |
1150 | 1154 | | |
1151 | | - | |
| 1155 | + | |
1152 | 1156 | | |
1153 | 1157 | | |
1154 | 1158 | | |
1155 | 1159 | | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
1156 | 1167 | | |
1157 | 1168 | | |
1158 | 1169 | | |
| |||
0 commit comments