Hey!
Is this newsletter alive?:)
Disclaimer: I'm not very familiar with system programming and POSIX
I'm playing around with `native` and ZeroMQ and found a curious behaviour.
(unless (fork)
(wait 2000)
(bye))
(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
(setq ZMQ_REP 4)
(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:5555")
(buf
Buffer 10
(prinl "Waiting for messages")
(when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
(prinl (pack "Error: " (errno)))))
Basically, the main process sets up a server and waiting for a message and the
child process simply waits for a bit and exits with `bye`.
The `errno` is 4 (which is signal interrupt as i understand).
The waiting in the child process is important because if it exits before zeromq
code, everything's fine and the server is patiently waiting.
My assumption here is that `bye` throws some signal? Why else would it affect
zeromq in the parent process?
Just looking for some explanation. Maybe even the proper way to resolve this.
Actually, while writing this I found out about SIGCHLD which is apparently sent
to parent on child's exit so I guess zmq_recv gets interrupted by that for some
reason? Weird. Can anyone confirm that's what I'm seeing?
P.S. completely offtopic but since I'm here. I just noticed that semicolons
aren't treated as comments. Why? Can it be enabled? Otherwise my Emacs'
lisp-mode comment/uncomment function is useless and no comment highlight either.
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe