From: <kai...@t-...> - 2003-06-10 18:10:08
|
Hi, I don't think it would be as easy to implement named pipes without using threads. To prevent deadlocks, there needs to be a process ready to write to any existing named threads when gnuplot wants to read it. I suppose this could be done by polling, but I don't quite know when the polling should take place. In any case, it would not be nearly as easy to implement as the multithreaded version, and probably not as robust. You realize, of course, that you can use the old-fashioned method of temporary files even in the new version of Gnuplot.py? But then you have the old problems, too. I've forwarded this answer to the gnuplot-py-users mailing list, in case anybody else has any thoughts on this issue. I would suggest that you subscribe to the list and send future questions there as a number of active users monitor this list. Yours, Michael Jonathan Ricketson wrote: > Hi Michael, I am trying to implement the new version of Gnuplot-py at > the moment after being very happy with the old version, but having > some problems that would be fixed by the new named pipes. > > Background: I am using debian linux, python 2.2.1 has threading > compiled in and I am using the version of Gnuplot-py from the cvs from > a couple of weeks ago (you don't seem to have committed any changes > since then). I have been using Gnuplot-py as part of a web application > using mod-python and apache. > > > The problem is that apache 1.3 does not support threading, and your > new changes utilise threads. Could you explain the neccessity of > threading here, and do you think that it is possible to get away with > not using it? > > def __init__(self, content, mode='w'): > self.content = content > self.mode = mode > self.filename = tempfile.mktemp() > threading.Thread.__init__( > self, > name=('FIFO Writer for %s' % (self.filename,)), > ) > os.mkfifo(self.filename) > self.start() > > def run(self): > f = open(self.filename, self.mode) > f.write(self.content) > f.close() > os.unlink(self.filename) > > Thanks for your help. > > > Jonathan -- Michael Haggerty mh...@al... |