This is an archive of the discontinued LLVM Phabricator instance.

[Support] Fix races during thread pool teardown
AbandonedPublic

Authored by davezarzycki on Jan 2 2020, 9:24 AM.

Details

Reviewers
zturner
chandlerc
Summary

This fixes various races and cleans up the thread pool logic. In particular:

  1. The ThreadPoolExecutor destructor now waits for the pool to fully exit before letting potentially in-use instance variables be implicitly destroyed.
  2. Explicitly joining threads ensures that thread-specific data destruction is complete.

Diff Detail

Event Timeline

davezarzycki created this revision.Jan 2 2020, 9:24 AM

A related question, why is this code reinventing thread joining? Would anybody mind if I clean this up?

davezarzycki retitled this revision from [Support] Fix race during thread pool teardown to [Support] Fix races during thread pool teardown.
davezarzycki edited the summary of this revision. (Show Details)

Rather than a targeted fix, let's just clean up the code and fix other bugs along the way.

davezarzycki abandoned this revision.Jan 15 2020, 8:55 AM

This should in theory be fixed by D70447.