FAQ
I have a server (derived from mutithreading SocketServer.py) and a
client running on the same host, connectet via AF_INET-Socket.

The server creates for every request a new thread. So I have three
threads now. The main thread, a second thread that executes a
loop-function, in which my problematic function is called, and a third
thread created by a request from my client.

class Requesthandler:
def __init__(self):
.....
self.lock = thread.allocate_lock()

def Loop(self): #runs in one thread
time.sleep(self.updatetime)
self.ProblemFunction()

def ProblemFunction(self):
print "before aquire()"
self.lock.aquire()
print "locked"
....do something....
self.lock.release()
print "unlocked"

def HandelRequestFromClient(self): #runs in another thread
self.ProblemFunction()

.........


The client causes the server periodically to call its ProblemFunction()
too.

class Client:
def __init__(self):
.....
signal.signal(signal.SIGALRM, self.LoopSignalHandler)
signal.alarm(self.updatetime)

def LoopSignalHandler(self):
Cause_Server_to_execute_ProblemFunction()


........

My problem is, that it works for 20 minutes an then I have a deadlock.
"before aquire()" is printed and the function is blocked in both
threads.
The problem is not the "do something"-stuff!
Any ideas why?

Thanks Thomas

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 10, '00 at 7:18p
activeMay 10, '00 at 7:27p
posts2
users1
websitepython.org

1 user in discussion

Thomas Thiele: 2 posts

People

Translate

site design / logo © 2022 Grokbase