Make sure the wakePend flag does not incur undefined behavior.

The wakePend flag currently has undefined behavior as multiple threads
read and write to it without a consistent locking mechanism.  This
switches writes and reads to use C++11's release-consume ordering
when available.  Without this patch, we have undefined behavior - which
is illegal with C++11.

The release-consume ordering is sufficient to guarantee atomicity
and the ordering of wakePend writes; other than that, it's a very
weak memory model.  In practice, this is a guarantee already provided
by all interesting architectures (it only generates different assembler
on DEC Alpha).

Fixes #167.  Upstream states they do not care about undefined behavior here, so putting it into the cms/v4.0.4 branch.