lestrrat/p5-ZMQ — pull request #12 by melo (2012-08-21 23:18:46+00:00)
Title: Fix zmq_init + fork and over-eager destructors (#11)

This is my first stab at a fix for #11.

It's not complete yet, there is still a invalid instruction trap: 4 on my system, but I don't know what is the next step on this.

Also: the code to see if we should call `zmq_term` is in the destructor logic. I think it should be moved to `zmq_term` itself. If `zmq_term` detects it should not terminate the context, because it was created in a different interp, it would return `undef`.

The destructor would call `zmq_term` and if the result is not `undef`, it would go ahead with the rest of the logic.

This would prevent direct calls to `zmq_term` on child process to cause havoc.