Merge pull request #1280 from hintjens/master

Problem: very hard to debug security mechanism mismatch
Merge pull request #1281 from hintjens/master

Problem: need atomic reference counting in several projects
Problem: 'bool' is not defined by default

zmq_atomic_counter_dec returned a 'bool' value, yet this isn't
defined by standard, so causes compile errors in upstream code.

Solution: return an int that can be safely converted to bool if
needed by bindings.
Problem: test cases were sporadically failing

Solution: increase settle time for bind/unbind tests