Login

Snippets by mwolgemuth

Snippet List

decorator to synchronize method at class / module level

This decorator allows you to wrap class methods or module functions and synchronize access to them. It maintains a dict of locks with a key for each unique name of combined module name and method name. (Implementing class name is lost in decorator? Otherwise it would have class name too if available.) Effectively it functions as a class level method synchronizer, with the lock handling completely hidden from the wrapped function.

  • decorator
  • method
  • class
  • synchronize
Read More

mwolgemuth has posted 2 snippets.