signal

Donn Cave donn at u.washington.edu
Tue Aug 1 13:55:04 EDT 2000


Quoth Thomas Thiele <thiele at muc.das-werk.de>:
| I want to do this under WinNT (under UNIX it works fine bur NT did know
| SIGALRM:
|
| def Loop_Init(self):
|   signal.signal(signal.SIGALRM, self.LoopSignalHandler)
|   signal.alarm(self.updatetime)
|
|  def LoopSignalHandler(self, signum, frame):
|   self.Update()
|   signal.alarm(self.updatetime)
|
| I need a functionality to update some things periodically and I don't
| want rto use an extra thread for this.
| Any ideas?

It depends an awful lot on what you're doing, both in "update some things"
and in the rest of the program.  select() with timeouts works well in
some multiple task situations, more useful and reliable than alarm()
and I believe more portable.  Commonly you'd use this approach where
the program spends its time waiting for input on a socket.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list