linkcheck.lock

Locking utility class.

Functions

get_lock(name[, debug])

Get a new lock.

get_semaphore(name[, value, debug])

Get a new semaphore.

Classes

DebugLock(lock, name)

Debugging lock class.

class linkcheck.lock.DebugLock(lock, name)[source]

Bases: object

Debugging lock class.

Store lock and name parameters.

acquire(blocking=1)[source]

Acquire lock.

release()[source]

Release lock.

linkcheck.lock.get_lock(name, debug=False)[source]

Get a new lock.

Parameters:

debug (boolean, default is False) – if True, acquire() and release() will have debug messages

Returns:

a lock object

Return type:

threading.Lock or DebugLock

linkcheck.lock.get_semaphore(name, value=None, debug=False)[source]

Get a new semaphore.

Parameters:
  • value – if not None, a BoundedSemaphore will be used

  • debug (boolean, default is False) – if True, acquire() and release() will have debug messages

Returns:

a semaphore object

Return type:

threading.Semaphore or threading.BoundedSemaphore or DebugLock