ThreadedServer.py 588 Bytes
import time

from Server import Server
from Event.EventThread import EventThread

class ThreadedServer(Server):
    def __init__(self, application, threads = 1):
        super(ThreadedServer, self).__init__(application)
        self._threads = []

        for num in range(1, threads):
            self._threads.append(
                    EventThread(self._dispatcher, 'th' + str(num)))

    def start(self, heartbeat = None):
        for thread in self._threads:
            thread.start()

        super(ThreadedServer, self).start(heartbeat)

# vim: set ft=python et ts=8 sw=4 sts=4: