This is an archive of the discontinued LLVM Phabricator instance.

Split the locking of the queue and the threads vector in the ThreadPool implementation
ClosedPublic

Authored by mehdi_amini on Dec 3 2021, 1:52 PM.

Details

Summary

This allows to release the QueueLock early and create Thread
independently of the queue processing.

Diff Detail

Event Timeline

mehdi_amini created this revision.Dec 3 2021, 1:52 PM
mehdi_amini requested review of this revision.Dec 3 2021, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2021, 1:52 PM
mehdi_amini edited the summary of this revision. (Show Details)

Minor fixes after testing

Replace max with min, obviously...

Benoit accepted this revision.Dec 3 2021, 7:24 PM
Benoit added inline comments.
llvm/include/llvm/Support/ThreadPool.h
44

is the performance benefit of avoiding some small mallocs worth the line of code?

llvm/lib/Support/ThreadPool.cpp
29–30

how about using a new variable instead of mutating requested?

This revision is now accepted and ready to land.Dec 3 2021, 7:24 PM
mehdi_amini marked an inline comment as done.Dec 3 2021, 8:08 PM
mehdi_amini added inline comments.
llvm/include/llvm/Support/ThreadPool.h
44

Probably not, happy to leave it out, it does not really belong to this patch anyway I think.