Closed gnh1201 closed 9 months ago
After applying the improvements, when using the writeFile
and readFile
function and providing absolutely nothing, not even a blank (''), it would simply wait indefinitely without performing any task.
function writeFile(FN, content, charset) {
if (typeof content === "undefined") {
console.warn("CONTENT has not been passed. Force to empty string.");
content = '';
}
if (typeof charset === "undefined") {
console.warn("CHARSET has not been passed. Force to UTF-8.");
charset = PipeIPC.CdoUTF_8;
}
var pipe = PipeIPC.connect("volatile");
pipe.setCharset(charset);
pipe.startRecorder(FN, PipeIPC.ForWriting);
pipe.write(content);
pipe.destroy();
return true;
}
function readFile(FN, charset) {
if (typeof charset === "undefined") {
console.warn("CHARSET has not been passed. Force to UTF-8.");
charset = PipeIPC.CdoUTF_8;
}
var text = '';
var pipe = PipeIPC.connect("volatile");
pipe.setCharset(charset);
pipe.loadFromFile(FN, charset);
text += pipe.read();
pipe.destroy();
return text;
}
var filename = "helloworld.txt";
writeFile(filename); // not correctly but allowed
//writeFile(filename, "helloworld", "utf-8"); // correctly
var text = readFile(filename); // not correctly but allowed
//readFile(filename, "utf-8"); // correctly
console.log(text);
Done
Summary
Resolution of issues encountered when requiring concurrencies in a multiprocessing environment
Related to IPC(Inter-Process Communication)
Related to processes
async
keyword -> make aAsyncFunction
class (lib/std)Related issues
63
55
37
32
26
7