Fix some memory_order parameters in AtomicHashMap
Summary: Herb Sutter noticed an error in the AHM find pseudo-code at
the C++ conference, and the error is in the real implementation too.
We should be using memory_order_acquire, because we need the load of
the key to happen before any subsequent loads of the value itself.
Our implementation is conservative for a memory_order_relaxed load
(we generate the same code as if it were memory_order_acquire---i.e. a
compiler barrier but no memory barriers), so this should not change the
generated code. Correctness is a good idea, though (when we upgrade
to gcc 4.7's atomics it might not be as conservative). Also, erase was
doing three loads when one is enough. ... also fixes an exception safety
bug in insert. (Phew.)
Test Plan: Ran the AHM unit tests, debug and opt.
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D485744
Some typos corrects, and collapsed the two descriptions of Bits.h into one.
Summary: https://github.com/facebook/folly/pull/1
Test Plan: N/A.
Reviewed By: andrewjcg@fb.com
FB internal diff:
D485738
Add #include <new> to folly/Malloc.h.
Test Plan: folly tests
Reviewed By: philipp@fb.com, andrei.alexandrescu@fb.com
FB internal diff:
D486884,
D487376
Check the return value from malloc / realloc.
Summary:
https://github.com/facebook/folly/issues/7
Wrappers: checkedMalloc / checkedRealloc / checkedCalloc
Test Plan: all folly tests
FB internal diff:
D486841
Fix error in ProducerQueue::isEmpty
Summary:
Oops.
Also: documented the slightly confusing behavior w.r.t. 'size'.
Test Plan: Added a unit test.
Reviewers: tjackson, jdelong
Reviewed By: jdelong
CC: folly@lists, lr, bagashe
Differential Revision: https://phabricator.fb.com/
D486832
Typos.
Summary:
As pointed out by orbitcowboy at
https://github.com/facebook/folly/issues/6
Test Plan: No
Reviewers: jdelong, aalexandre
Reviewed By: jdelong
CC: folly@lists, bagashe
Differential Revision: https://phabricator.fb.com/
D486754
Adding support for in-place use of ProducerConsumerQueue.
Summary: As it is, ProducerConsumerQueue requires that values are moved or copied on the way out of the queue. It would be nice if it was possible to get a reference to the front of the queue, use it in place, then destruct it.
Test Plan: Unit tests
FB internal diff:
D484538