ref: 2fa0cd4d44ef4e7340576579fca40897041f93fa
parent: 7ae4c9dfd54b610ba916dce3f351834573265849
author: qwx <qwx@sciops.net>
date: Sat Jan 7 20:56:23 EST 2023
write to file without interrupting main thread
--- a/cmd.c
+++ b/cmd.c
@@ -392,7 +392,7 @@
static int
writeto(char *arg)
{
- int r, fd;
+ int fd;
if(dot.to - dot.from == 0){
werrstr("writeto: dot isn't a range");
@@ -402,9 +402,12 @@
werrstr("writeto: %r");
return -1;
}
- r = writebuf(fd);
+ if(procrfork(wproc, (int*)fd, mainstacksize, RFFDG) < 0){
+ fprint(2, "procrfork: %r\n");
+ return -1;
+ }
close(fd);
- return r;
+ return 0;
}
int
--- a/pplay.man
+++ b/pplay.man
@@ -263,6 +263,8 @@
.PP
Mousing, in particular for panning, can be uncomfortable or annoying.
.PP
+There are no safeguards against races when writing to file.
+.PP
The data structure implementation underlying the editing commands
is, despite much effort to the contrary, still prone to off-by-ones
and other bugs.