Re: Global variables problem

2010-08-04 Thread Jean-Michel Pichavant
Navkirat Singh wrote: On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh > wrote: Hey guys, I am using a multiprocessing program, w

Re: Global variables problem

2010-08-04 Thread Matteo Landi
Usually, modify global variables in a multi-thread/multi-process scenario is not the right to operate: you better re-implement your solution in a way that the shared resource is either protected with synchronized objects or accessed by a single thread/process (and in this case, it won't be a share

Re: Global variables problem

2010-08-04 Thread Navkirat Singh
: ( False alarm, the earlier solution breaks multiprocessing. Whats happening here is the child needs to change a variable in the parent process, So I think I am looking at shared memory (maybe). Any suggestions? Regards, Nav On 04-Aug-2010, at 12:41 PM, Navkirat Singh wrote: > Thanks a l

Re: Global variables problem

2010-08-04 Thread Navkirat Singh
Thanks a lot guys !! I solved the problem: In the lines: >> new_process = process(target=newprocess) >>new_process.start() The target=newprocess is pointing towards a variable, instead of a function. So, appending a () will make it goto that function, thereby changing

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
Your problem lies somewhere in the use of the Process class, not with global variables. If you replace your "p = ..." and "p.start()" lines with a direct call to self.handle_connection(), your code works as expected. I don't know much about the multiprocessing module, so I can't really comment on

Re: Global variables problem

2010-08-03 Thread Navkirat Singh
On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: > Please post approximate code that actually works and displays the problem. > > On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh wrote: > Hey guys, > > I am using a multiprocessing program, where the new process is supposed to > change a vari

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh wrote: > Hey guys, > > I am using a multiprocessing program, where the new process is supposed to > change a variable in the main class that it branches out from. This is > s

Global variables problem

2010-08-03 Thread Navkirat Singh
Hey guys, I am using a multiprocessing program, where the new process is supposed to change a variable in the main class that it branches out from. This is somehow not working, following is an approximate code. Would really appreciate any insight into this matter: var = {} class Something():