On 09-12-10 01:37, Mike Dewhirst wrote:
> It seems like a good place to put it. Maybe you can test to see if the
> threads have been started already?
>
> Here is a singleton which could live in your __init__.py and might
> help to record the state of your threading ... or anything else for
> that matter.
>
> class singleton(object):
> """ designed by Oren Tirosh and Jeff Pitman """
> def __new__(self, *args, **kwargs):
> if not '_singleton' in self.__dict__:
> slate = object.__new__(self)
> slate.state = {
> 'threads':True,
> # add other state things as required
> }
> self._singleton = slate
> return self._singleton
>
> hth
>
> Mike
>
Sorry but I don't really understand how works the function you gave me.
In my case, I create several objects like this :
# __init__.py
profile_rec_port = ProfileRecorder()
evaluation_port = EvaluationManager()
...
# evaluationmanager.py
class EvaluationManager(Thread):
def __init__(self):
self.port = Queue() # Initialize an infinite empty queue
Thread.__init__(self) # Initialze the thread
self.start() # Launch the thread
...
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.