MPMCQueue - FPE to invalid_argument for 0 capacity
Summary:
If an MPMCQueue was initialized with an explicit zero capacity, it would
try to compute stride for zero and trigger SIGFPE which pretty fatally
killed the process -- but in a way that required gdb to figure out the
root cause.
This replaces that with a std::invalid_argument exception, which
includes a description of the problem and should make fixing this user
error much faster.
Test Plan:
GTEST unit test added to verify behaviour; if this didn't work it would
SIGFPE and abort the test script, which is probably a good indicator
that something went wrong. :)
fbconfig -r folly && fbmake runtests
Reviewed By: ngbronson@fb.com
Subscribers: chalfant, folly-diffs@, yfeldblum, rkomorn
FB internal diff:
D1930978
Signature: t1:
1930978:
1427740315:
cc06a8b9f3c314b956ae41f813b2f904d3e979c9