Message100707
Hi,
The following code results in an infinite loop -->
# ----
import multiprocessing
def f(m):
print(m)
p = multiprocessing.Process(target=f, args=('pouet',))
p.start()
# ----
I've firstly think about an issue in my code when Python loads this module so I've added a "if __name__ == '__main__':" and it works well. But, with the following code Python enters in the same infinite loop -->
proc.py:
# ----
import multiprocessing
def f(m):
print(m)
class P:
def __init__(self, msg):
self.msg = msg
def start(self):
p = multiprocessing.Process(target=f, args=(self.msg,))
p.start()
# ----
my_script.py:
# ----
from proc import P
p = P("pouet")
p.start()
# ----
It's like Python loads all parent's process memory space before starting process which issues in an infinite call to Process.start() ... |
|
| Date |
User |
Action |
Args |
| 2010-03-09 09:01:54 | Kain94 | set | recipients:
+ Kain94 |
| 2010-03-09 09:01:54 | Kain94 | set | messageid: <1268125314.35.0.202558750367.issue8094@psf.upfronthosting.co.za> |
| 2010-03-09 09:01:52 | Kain94 | link | issue8094 messages |
| 2010-03-09 09:01:51 | Kain94 | create | |
|