|
Acts as the asynchronous version of a synchronized
decorator (inspired by Java's keyword). Ensures that no event-handling
path (the asynchronous equivalent to threads) will enter the function if
another one is currently in it (which can happen if the current
"thread" is itself waiting on a deferred, thus giving the
reactor an opportunity to execute the competing "thread").
Provides additional protection against Twisted bug
411. In this case, if too many acquisition requests are chained onto
the deferred which is fired on release, then the stack will overflow.
This is circumvented by maintaining a queue of closures and deferreds
which is checked on each release, to keep the callback chain
"flat."
- Parameters:
func (function) - The function to decorate.
- Returns: function
- The "thread-safe" version of the function.
|