I have a question about this runtime.KeepAlive call:

https://github.com/golang/go/blob/041ecb697f0e867a2bb0bf219cc2fd5f77057c2e/src/os/dir_unix.go#L68

(There are other examples in the stdlib as well, I think.)

It seems to me that, strictly speaking, KeepAlive is unnecessary here
since the compiler/runtime cannot know whether the loop will terminate
before the result of the ReadDirent is seen. Is that true?

I'm not arguing that the KeepAlive should be removed; it's probably
best to stick with the pattern syscall(f.Fd(), ...);
runtime.KeepAlive(f) in most cases. I'm just checking my understanding
here.

Thanks!
Caleb

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to