ref: ef82ceaa8ce0a5665f690c1001595f1c486dce8b
parent: d8f18c2bdf5f7348de4d5133faaba2d822b08297
author: qwx <[email protected]>
date: Fri Feb 3 22:06:04 EST 2023
cmd: promote read thread to proc allows for loading without playback interruption
--- a/cmd.c
+++ b/cmd.c
@@ -312,7 +312,7 @@
/* using a thread does slow down reads a bit */
// FIXME: ugly
static void
-rthread(void *efd)
+rproc(void *efd)
{
int fd;
Dot d;
@@ -348,8 +348,8 @@
fprint(2, "procrfork: %r\n");
return -1;
}
- if(rr && threadcreate(rthread, (int*)dup(epfd[1], -1), mainstacksize) < 0){
- fprint(2, "threadcreate: %r\n");
+ if(rr && procrfork(rproc, (int*)dup(epfd[1], -1), mainstacksize, RFFDG) < 0){
+ fprint(2, "procrfork: %r\n");
return -1;
}
close(epfd[1]);
@@ -390,8 +390,8 @@
if((fd = open(s, OREAD)) < 0)
return -1;
- if(threadcreate(rthread, (int*)fd, mainstacksize) < 0){
- fprint(2, "threadcreate: %r\n");
+ if(procrfork(rproc, (int*)fd, mainstacksize, RFFDG) < 0){
+ fprint(2, "procrfork: %r\n");
return -1;
}
return 0;