~unity-api-team/unity-scopes-api/child-scopes-option

Viewing all changes in revision 479.

  • Committer: Tarmac
  • Author(s): Michi Henning
  • Date: 2014-09-05 11:33:08 UTC
  • mfrom: (467.3.11 fix-reaper-test)
  • Revision ID: tarmac-20140905113308-nib6fu11qao7hpyg
The reaper test could race with the reap thread, causing the test to fail.

Changed Reaper to use a weak_ptr instead of std::function to get at the callback, to avoid holding ReapItems alive longer than necessary.

Changed implementation such that, once a call to destroy() on a ReapItem returns, it is guaranteed that the reaper thread won't fire the callback. Previously, it was possible for the callback to still fire after a destroy() call completed, because the reap thread runs completely asynchronously. But, having this happen could be embarrassing:

auto o = new SomeObj(...);
auto ri = reaper->add(bind(&SomeObj::some_method, o));
...
ri->destroy();
delete o;
// Oops, callback could happen here, calling into deleted o.

Added more tests.

Approved by Pawel Stolowski, Pete Woods, PS Jenkins bot.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: