Ryota Ozaki <ozaki-r%netbsd.org@localhost> writes: > BTW, I worry about there is no easy way to > know if a function in a critical section > blocks/sleeps or not. So I wrote a patch to > detect that: http://www.netbsd.org/~ozaki-r/debug-pserialize.diff > Is it meaningful? It seems sensible, but it is very much undercommented. Somewhere, the point of the variable, what it means, and why the test is right should be explained. I think the point is that sleep should not be called while pserialize is active. And probably preemption shouldn't happen either, so we won't get false hits from other threads sleeping. I realize it's typical to reject adding such comments on the theory that everyone should already understand all of this. But the complexity of our locking (and memory allocation) is high, and I think it helps correctness to be much more explicit about the plan.
Attachment:
pgpb3HrEgv73Y.pgp
Description: PGP signature