libera/#sbcl - IRC Chatlog
Search
3:08:59
nij-
Anyone knows which protocol does sb-ext:run-program use to talk the the subprocess (when input and output are set to :stream)? Is it udp or tcp?
3:09:27
nij-
I got lost in the source code @_@: https://github.com/sbcl/sbcl/blob/e574a5bedfc38aac1a6675f4fe1ee7132ef60d75/src/code/run-program.lisp#L708
3:14:08
joshe
sockets only use internet protocols if you specify AF_INET or AF_INET6 for the first argument to socket(2)
3:17:42
joshe
well, I suppose it would be wrapped in internal kernal data structures, like whenever you ask the kernel to manage data for you
3:18:32
joshe
but you wouldn't have to think about how the kernel manages that any more than you have to think about how the kernel manages the files you ask it to open for you
3:21:35
joshe
it's hard to say, then kernel could implement things however it wishes as long as the interface is fulfilled
3:24:18
nij-
This makes it fast in communication! What if I want to make it safe? Can I enforce tcp on run-program?
3:25:09
joshe
stdio can wrap anything that the kernel uses a file descriptor for, and which supports read and write
3:27:10
nij-
suppose I launch a process with run-program, and I want to send the process many tasks to do.
3:27:31
nij-
The process needs to be able to receive information at any time. They might come broken.
3:27:51
nij-
With protocol like TCP, things will be in order automatically (but it's slower for the safety ensurance)
3:32:31
nij-
So I have many threads in sbcl. Each thread sends messages to the process launched by run-program.
3:33:37
joshe
if you write things to a tcp socket out of order then tcp will faithfully deliver them out of order
3:47:36
joshe
it sounds like run-program isn't the problem, but perhaps managing your data in some sort of shared queue
3:49:20
joshe
which might mean reading up more on what sort of thread-safe data structure you might need
14:43:45
scymtym
does (funcall (compile nil `(lambda (x) (when x (print 1)) (loop))) nil) go into an infinite loop printing 1s for anybody else (don't try it in an important session, the loop can be difficult to interrupt)?