How to use the decorator.synchronized function in decorator

To help you get started, we’ve selected a few decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zopefoundation / Zope / src / Products / MailHost / MailHost.py View on Github external
    @synchronized(lock)
    def _stopQueueProcessorThread(self):
        """ Stop thread for processing the mail queue.
        """
        key = self._getThreadKey()
        if queue_threads.has_key(key):
            thread = queue_threads[key]
            thread.stop()
            while thread.isAlive():
                # wait until thread is really dead
                time.sleep(0.3)
            del queue_threads[key]
            LOG.info('Thread for %s stopped' % key)
github zopefoundation / Zope / lib / python / Products / MailHost / MailHost.py View on Github external
    @synchronized(lock)
    def _stopQueueProcessorThread(self):
        """ Stop thread for processing the mail queue """
        key = self._getThreadKey()
        if queue_threads.has_key(key):
            thread = queue_threads[key]
            thread.stop()
            while thread.isAlive():
                # wait until thread is really dead
                time.sleep(0.3)
            del queue_threads[path]
            LOG.info('Thread for %s stopped' % key)
github zopefoundation / Zope / src / Products / MailHost / MailHost.py View on Github external
    @synchronized(lock)
    def _startQueueProcessorThread(self):
        """ Start thread for processing the mail queue.
        """
        key = self._getThreadKey()
        if not queue_threads.has_key(key):
            thread = QueueProcessorThread()
            thread.setMailer(self._makeMailer())
            thread.setQueuePath(self.smtp_queue_directory)
            thread.start()
            queue_threads[key] = thread     
            LOG.info('Thread for %s started' % key)
github zopefoundation / Zope / lib / python / Products / MailHost / MailHost.py View on Github external
    @synchronized(lock)
    def _startQueueProcessorThread(self):
        """ Start thread for processing the mail queue
        """
        key = self._getThreadKey()
        if not queue_threads.has_key(key):
            thread = QueueProcessorThread()
            thread.setMailer(self._makeMailer())
            thread.setQueuePath(self.smtp_queue_directory)
            thread.start()
            queue_threads[key] = thread     
            LOG.info('Thread for %s started' % key)