Skip to content

Commit

Permalink
Non blocking ReservedThreadExecutor (#6535)
Browse files Browse the repository at this point in the history
A call to offer must never block, nor even yield, since to do so give an opportunity for the allocated CPU core to change, defeating the whole purpose of the class.
There is also some reasonable level of diagnostic warnings if a reserved thread misses too many offers consecutively, based on tracking the state of the reserved thread.

Remove the stack data structure entirely.  ReservedThreads all poll the same SynchronousQueue and tryExecute does a non blocking offer.

Added test for busy shrinking

Remember last time we hit zero reserved threads

Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
gregw and sbordet committed Jul 28, 2021
1 parent ea5c8ed commit 735e97d
Show file tree
Hide file tree
Showing 2 changed files with 216 additions and 164 deletions.

0 comments on commit 735e97d

Please sign in to comment.