/head: changeset 68
More work on threads
This commit is contained in:
parent
f53273ffc3
commit
8efda69ef0
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
from offlineimap import imaplib, imaputil, threadutil
|
from offlineimap import imaplib, imaputil, threadutil
|
||||||
from threading import *
|
from threading import *
|
||||||
import sys
|
|
||||||
|
|
||||||
class UsefulIMAPMixIn:
|
class UsefulIMAPMixIn:
|
||||||
def getstate(self):
|
def getstate(self):
|
||||||
@ -82,9 +81,6 @@ class IMAPServer:
|
|||||||
self.availableconnections.append(connection)
|
self.availableconnections.append(connection)
|
||||||
self.connectionlock.release()
|
self.connectionlock.release()
|
||||||
self.semaphore.release()
|
self.semaphore.release()
|
||||||
print "%d connections used after release" % len(self.assignedconnections)
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
|
|
||||||
def acquireconnection(self):
|
def acquireconnection(self):
|
||||||
"""Fetches a connection from the pool, making sure to create a new one
|
"""Fetches a connection from the pool, making sure to create a new one
|
||||||
@ -101,8 +97,6 @@ class IMAPServer:
|
|||||||
self.assignedconnections.append(imapobj)
|
self.assignedconnections.append(imapobj)
|
||||||
del(self.availableconnections[0])
|
del(self.availableconnections[0])
|
||||||
self.connectionlock.release()
|
self.connectionlock.release()
|
||||||
print "%d connections used after acquire" % len(self.assignedconnections)
|
|
||||||
sys.stdout.flush()
|
|
||||||
return imapobj
|
return imapobj
|
||||||
|
|
||||||
self.connectionlock.release() # Release until need to modify data
|
self.connectionlock.release() # Release until need to modify data
|
||||||
@ -124,8 +118,6 @@ class IMAPServer:
|
|||||||
self.connectionlock.acquire()
|
self.connectionlock.acquire()
|
||||||
self.assignedconnections.append(imapobj)
|
self.assignedconnections.append(imapobj)
|
||||||
self.connectionlock.release()
|
self.connectionlock.release()
|
||||||
print "%d connections used after acquire" % len(self.assignedconnections)
|
|
||||||
sys.stdout.flush()
|
|
||||||
return imapobj
|
return imapobj
|
||||||
|
|
||||||
def connectionwait(self):
|
def connectionwait(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user