Module parking_lot

Source

ModulesΒ§

deadlock
[Experimental] Deadlock detection

StructsΒ§

Bucket πŸ”’
FairTimeout πŸ”’
HashTable πŸ”’
ParkToken
A value associated with a parked thread which can be used by unpark_filter.
ThreadData πŸ”’
UnparkResult
Result of an unpark operation.
UnparkToken
A value which is passed from an unparker to a parked thread.

EnumsΒ§

FilterOp
Operation that unpark_filter should perform for each thread.
ParkResult
Result of a park operation.
RequeueOp
Operation that unpark_requeue should perform.

ConstantsΒ§

DEFAULT_PARK_TOKEN
A default park token to use.
DEFAULT_UNPARK_TOKEN
A default unpark token to use.
LOAD_FACTOR πŸ”’

StaticsΒ§

HASHTABLE πŸ”’
Holds the pointer to the currently active HashTable.
NUM_THREADS πŸ”’

FunctionsΒ§

create_hashtable πŸ”’
Returns a reference to the latest hash table, creating one if it doesn’t exist yet. The reference is valid forever. However, the HashTable it references might become stale at any point. Meaning it still exists, but it is not the instance in active use.
get_hashtable πŸ”’
Returns a reference to the latest hash table, creating one if it doesn’t exist yet. The reference is valid forever. However, the HashTable it references might become stale at any point. Meaning it still exists, but it is not the instance in active use.
grow_hashtable πŸ”’
hash πŸ”’
lock_bucket πŸ”’
Locks the bucket for the given key and returns a reference to it. The returned bucket must be unlocked again in order to not cause deadlocks.
lock_bucket_checked πŸ”’
Locks the bucket for the given key and returns a reference to it. But checks that the key hasn’t been changed in the meantime due to a requeue. The returned bucket must be unlocked again in order to not cause deadlocks.
lock_bucket_pair πŸ”’
Locks the two buckets for the given pair of keys and returns references to them. The returned buckets must be unlocked again in order to not cause deadlocks.
park⚠
Parks the current thread in the queue associated with the given key.
rehash_bucket_into πŸ”’ ⚠
Iterate through all ThreadData objects in the bucket and insert them into the given table in the bucket their key correspond to for this table.
unlock_bucket_pair πŸ”’ ⚠
Unlock a pair of buckets
unpark_all⚠
Unparks all threads in the queue associated with the given key.
unpark_filter⚠
Unparks a number of threads from the front of the queue associated with key depending on the results of a filter function which inspects the ParkToken associated with each thread.
unpark_one⚠
Unparks one thread from the queue associated with the given key.
unpark_requeue⚠
Removes all threads from the queue associated with key_from, optionally unparks the first one and requeues the rest onto the queue associated with key_to.
with_thread_data πŸ”’