2014-05-01 06:41:09 +00:00
|
|
|
import sys
|
|
|
|
import os
|
2017-09-03 08:10:56 +00:00
|
|
|
from multiprocessing import Process, Pipe
|
2014-05-01 06:41:09 +00:00
|
|
|
|
|
|
|
def f(conn):
|
|
|
|
conn.send([42, None, 'hello'])
|
|
|
|
conn.send([42, 42, 42])
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parent_conn, child_conn = Pipe(False)
|
2017-09-03 08:10:56 +00:00
|
|
|
#print(parent_conn, child_conn)
|
2014-05-01 06:41:09 +00:00
|
|
|
p = Process(target=f, args=(child_conn,))
|
2017-09-03 08:10:56 +00:00
|
|
|
|
2014-05-01 06:41:09 +00:00
|
|
|
# Extension: need to call this for uPy
|
2017-09-03 08:10:56 +00:00
|
|
|
if sys.implementation.name == "micropython":
|
|
|
|
p.register_pipe(parent_conn, child_conn)
|
|
|
|
|
2014-05-01 06:41:09 +00:00
|
|
|
p.start()
|
2017-09-03 08:10:56 +00:00
|
|
|
parent_conn.recv() == [42, None, 'hello']
|
|
|
|
parent_conn.recv() == [42, 42, 42]
|
2014-05-01 06:41:09 +00:00
|
|
|
p.join()
|