Allow to specify per-priority capacities in PriorityLifoSemMPMCQueue
authorGiuseppe Ottaviano <ott@fb.com>
Tue, 7 Nov 2017 06:41:52 +0000 (22:41 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 7 Nov 2017 06:50:39 +0000 (22:50 -0800)
commita77fea17099fba84cb98a6bcc0aa2404defd8054
tree0f44f1c37cb17d68f64fc6867f3afe0d782843ff
parent0718262d68d759b2db1007f70fe8d5faf3aed915
Allow to specify per-priority capacities in PriorityLifoSemMPMCQueue

Summary: The `THROW` behavior of `LifoSemMPMCQueue` is unsafe when calling `join()`, because the queue may be full and `join()` will fail to enqueue the poisons. To work around this we can use `PriorityLifoSemMPMCQueue` and dedicate `LO_PRI` to the poisons, but there's no reason that the low priority queue should have the same size as the normal priority. Add a constructor to be able to specify different sizes.

Reviewed By: yfeldblum

Differential Revision: D6257017

fbshipit-source-id: c75f33c38fcdad646ba1499bcd434ab65711250c
folly/executors/CPUThreadPoolExecutor.h
folly/executors/task_queue/PriorityLifoSemMPMCQueue.h
folly/executors/task_queue/test/PriorityLifoSemMPMCQueueTest.cpp [new file with mode: 0644]