python - why multiprocessing function Process doesn't work -
i want use module multiprocessing execute 2 functions @ same time doesn't work. code in these 2 functions depends on library of these 2 instruments, there has no matter multiprocessing
import multiprocessing mp def mesure_rfb(): libc.startmeas() time.sleep(0.5) while libc.measuring() == -1: time.sleep(1) def mesure_nrt(): global ave,rev,chrono my_nrt.zeroing() my_nrt.setimeout(100000) tstart = time.time() b=2 ave,rev,chrono = my_nrt.measurement(times=b) a=time.time()-tstart print('measurement cost: ' , a,' s') print('a measurement costs: ' , a/b,' s') if __name__ == '__main__': rfb = mp.process(name='rfb measuring', target=mesure_rfb) nrt = mp.process(name='nrt measuring', target=mesure_nrt) rfb.start() nrt.start() rfb.join() nrt.join()
as run part of programme, executes function mesure_nrt. quite new python. appreciated.
Comments
Post a Comment