[cse491] HW1: Reentrant Iterators
Edward Waller
wallered at msu.edu
Thu Aug 28 19:13:48 PDT 2008
So from wikipedia I see that
Reentrant: A computer program or routine is described as reentrant if
it can be safely executed concurrently; that is, the routine can be re-
entered while it is already running. To be reentrant, a function must:
Hold no static (global) non-constant data.
Must not return the address to static (global) non-constant data.
Must work only on the data provided to it by the caller.
Must not rely on locks to singleton resources.
Must not call non-reentrant functions.
Since def next(self): takes no arguments, how exactly are we supposed
to make this reentrant? The only thing I can think of is making a new
instance for the iterator like:
class ReentrantFibonacciIterator(FibonacciIterator, object):
def __iter__(self):
return ReentrantFibonacciIterator(self.n)
But i'm not sure if i'm the right track with that, it doesn't seem
like you're testing this?
Anyway if anyone has any ideas feel free to share =].
More information about the cse491-fall-2008
mailing list