re-entrancy question

re-entrancy question

Post by apocalypzn » Wed, 09 Feb 2005 18:39:17


I have a program that instantiates some objects and runs a main loop.
Before the main loop starts, I create a thread that listens to TCP
connections on a port. If any connections are made, and depending on
the data, I call methods on some of those objects.

I am worried that calling methods on objects from outside the main loop,
but that are also operated on in the main loop, could cause problems.

My questions:
1) is this safe?
2) what kind of problems could occur?
3) how do I safely handle this?
 
 
 

re-entrancy question

Post by Tim Golde » Wed, 09 Feb 2005 20:05:56

[apocalypznow]

| I have a program that instantiates some objects and runs a main loop.
| Before the main loop starts, I create a thread that listens to TCP
| connections on a port. If any connections are made, and depending on
| the data, I call methods on some of those objects.
|
| I am worried that calling methods on objects from outside the
| main loop,
| but that are also operated on in the main loop, could cause problems.
|
| My questions:
| 1) is this safe?
| 2) what kind of problems could occur?
| 3) how do I safely handle this?

No doubt there are more pertinent answers, but unless this is
a learning exercise, you'd be better off investigating Pyro:
http://www.yqcomputer.com/

TJG

(And, thinking about it, even if this is a learning exercise)

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.yqcomputer.com/
________________________________________________________________________

 
 
 

re-entrancy question

Post by dial#####$ » Wed, 09 Feb 2005 21:44:06


AFAIK pyro is just a RPC implementation for python whereas Twisted is a
completely different beast that happens to have its own implementation
of RPC.

How would the OP be better investigating something different, that he
probably doesn't even need?

Your comment would be pertinent only if it considered Perspective Broker
against pyro, and I admit I don't know how they compare.

--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://www.yqcomputer.com/
http://www.yqcomputer.com/
 
 
 

re-entrancy question

Post by Tim Golde » Wed, 09 Feb 2005 21:57:44


|
| > No doubt there are more pertinent answers, but unless this is
| > a learning exercise, you'd be better off investigating Pyro:
| > http://www.yqcomputer.com/
|
| AFAIK pyro is just a RPC implementation for python whereas
| Twisted is a
| completely different beast that happens to have its own implementation
| of RPC.
|
| How would the OP be better investigating something different, that he
| probably doesn't even need?
|
| Your comment would be pertinent only if it considered
| Perspective Broker
| against pyro, and I admit I don't know how they compare.


Here's the original post, quoted in its entirety:

<quote>
I have a program that instantiates some objects and runs a main loop.
Before the main loop starts, I create a thread that listens to TCP
connections on a port. If any connections are made, and depending on
the data, I call methods on some of those objects.

I am worried that calling methods on objects from outside the main loop,
but that are also operated on in the main loop, could cause problems.

My questions:
1) is this safe?
2) what kind of problems could occur?
3) how do I safely handle this?
</quote>

Now *where* is there any mention of Twisted, either in the original
post or in my reply? As I read it, the OP is doing something which
creates local objects (instances, whatever) and has them available
remotely. He's then -- justifiably -- concerned about possible
re-entrancy if more than one outside agent makes a connection on
his TCP port.

It seemed to me that this was -- approximately -- what Pyro does:
you created objects locally and listen on a TCP port for incoming
requests. Since Pyro's author has already solved a number of the
problems associated with doing this kind of thing, I thought it
might be helpful to point this out.

Tim

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.yqcomputer.com/
________________________________________________________________________
 
 
 

re-entrancy question

Post by dial#####$ » Wed, 09 Feb 2005 23:02:18


Ya sorry. I thought this was crossposted but the OP posted 2 different
emails to both python-list and twisted-python ML. This very same message
was posted on the twisted mailing list.

The answer anyway was already given on the other list: there are no
re-entrancy problems :).

--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://www.yqcomputer.com/
http://www.yqcomputer.com/
 
 
 

re-entrancy question

Post by Tim Golde » Wed, 09 Feb 2005 23:09:27

[dial#####$$NOSPAM##$#$##@gmail.com]
|

|
| > Now *where* is there any mention of Twisted, either in the original
| > post or in my reply? As I read it, the OP is doing something which
|
| Ya sorry. I thought this was crossposted but the OP posted 2 different
| emails to both python-list and twisted-python ML. This very
| same message
| was posted on the twisted mailing list.
|
| The answer anyway was already given on the other list: there are no
| re-entrancy problems :).
|
| --
| Valentino Volonghi aka Dialtone

Ah, OK. I thought it was a bit bizarre.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.yqcomputer.com/
________________________________________________________________________