U vil@s\ddlmZddlmZddlmZddlmZddlmZddl m Z GdddeZ d S) )RLock)Optional)typing)DisposableBase)noop)Actioncs>eZdZdZd eejddfdd ZddddZZ S) DisposablezMain disposable classN)actionreturncs&d|_|p t|_t|_tdS)a[Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run at most once. Returns: The disposable object that runs the given action upon disposal. FN) is_disposedrr rlocksuper__init__)selfr  __class__P/opt/alt/python38/lib/python3.8/site-packages/reactivex/disposable/disposable.pyr s  zDisposable.__init__)r c Cs6d}|j|jsd}d|_W5QRX|r2|dS)z+Performs the task of cleaning up resources.FTN)r r r )rdisposerrrr!szDisposable.dispose)N) __name__ __module__ __qualname____doc__rrrrr __classcell__rrrrr srN) threadingrrrZ reactivexZ reactivex.abcrZreactivex.internalrZreactivex.typingrrrrrrs