'The target for both single and multi-threaded modes.'

def syncrunner(self):

    self.ui.registerthread(self)
    try:
        accountmetadata = self.getaccountmeta()
        if (not os.path.exists(accountmetadata)):
            os.mkdir(accountmetadata, 448)
        self.remoterepos = Repository(self, 'remote')
        self.localrepos = Repository(self, 'local')
        self.statusrepos = Repository(self, 'status')
    except OfflineImapError as e:
        self.ui.error(e, exc_info()[2])
        if (e.severity >= OfflineImapError.ERROR.CRITICAL):
            raise
        return
    looping = 3
    while looping:
        self.ui.acct(self)
        try:
            self.__lock()
            self.__sync()
        except (KeyboardInterrupt, SystemExit):
            raise
        except OfflineImapError as e:
            if (e.severity >= OfflineImapError.ERROR.REPO):
                if looping:
                    looping -= 1
                if (e.severity >= OfflineImapError.ERROR.CRITICAL):
                    raise
            self.ui.error(e, exc_info()[2])
        except Exception as e:
            self.ui.error(e, exc_info()[2], msg=("While    attempting    to    sync    account    '%s'" % self))
        else:
            if self.refreshperiod:
                looping = 3
        finally:
            self.ui.acctdone(self)
            self._unlock()
            if (looping and (self._sleeper() >= 2)):
                looping = 0
