Commit a93e6df3 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added the possibility to acquire/release the configuration lock.

 * Configuration lock also converted from Lock to RLock.
parent 2cc54931
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class CCConf(object):

    def __init__(self, path_directory):
        self._path = path_directory
        self._lock = threading.Lock()
        self._lock = threading.RLock()

    def _writer(func):
        '''
@@ -111,6 +111,23 @@ class CCConf(object):
        else:
            raise CCConf.UnknownAccount('%s is not a file' % filename)

    def acquire(self):
        '''
        Acquire the configuration writing lock for non-atomic configuration
        changes.

        .. warning::
           Don't forget to call the :meth:`release` method after your changes
           for each :meth:`acquire` you made.
        '''
        self._lock.acquire()

    def release(self):
        '''
        Release the configuration writing lock.
        '''
        self._lock.release()

    def show(self, login):
        '''
        Show the configuration for specified account.