~raof/mir/provide-event-fd

Viewing all changes in revision 2354.

  • Committer: Christopher James Halse Rogers
  • Date: 2015-03-25 23:55:20 UTC
  • Revision ID: christopher.halse.rogers@canonical.com-20150325235520-j8n09lwdeg0kpez3
Resolve race in terminate_one_thread.

If two threads called terminate_one_thread simultaneously it was possible for
both threadpool threads to unregister before either terminate_one_thread picked the
terminating_thread_mutex lock up again.

In this case the second threadpool thread would overwrite terminating_thread_id, and the
second terminate_one_thread call would timeout.

This is fundamentally a typical producer/consumer situation; resolve it by having terminating
threads write to a queue of ids, and terminate_one_thread pull from that queue.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: