[WIP] Add support for recursive locks and try_lock #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements a recursive lock using FEBs. The idea is that
qthreade_read_FE
becomes re-entrant ifqthread_read_FE
is called fromqthread_lock
andqthread_lock_init
has been called on the same address settingis_recursive
to true. Analogously,qthread_unlock
callsqthead_fill
which decrements a counter of a recursive lock. If the counter reaches zero, blocked waiters (EFQ) are unblocked.Uses of other FEB calls over recursive locks are unsupported and we could error out. Currently they have no effect but could lead to programming errors if programmer expects FEB synchronization over an address used for a recursive lock.
Todo
With this infrastructure, we should be able to support ULTs from Open MPI.
For Open MPI, we'd need then these changes:
janciesko/ompi@daef600
janciesko/ompi@bab853b