Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

multiprocessing write to dict

import multiprocessing
manager = multiprocessing.Manager()
shared_dict = manager.dict()

def worker1(d):
    d["a"] = 1

def worker2(d):
    d["b"] = 2

process1 = multiprocessing.Process(
    target=worker1, args=[shared_dict])
process2 = multiprocessing.Process(
    target=worker2, args=[shared_dict])

process1.start()
process2.start()
process1.join()
process2.join()

print shared_dict
OUTPUT
{'a': 1, 'b': 2}
Comment

PREVIOUS NEXT
Code Example
Python :: using pandas stack and subset to return a dataframe object of highly correated pairs 
Python :: Python - Comment convertir le texte en discours 
Python :: how to hack instagram account using python 
Python :: what is a rare earth 
Python :: python - notification messages 
Python :: python goose 
Python :: pandas get indices of mask 
Python :: b-spline quantile regression with statsmodels 
Python :: python specify multiple possible types 
Python :: flask int route 
Python :: best api for python 
Python :: was en francais 
Python :: how to identify set list and tuple in python 
Python :: text file sort by first item in each row 
Python :: code-server python extension 
Python :: df.iterrows write to column 
Python :: how to app object pyhthon 
Python :: python code to open facebook and login with username and password 
Python :: RuntimeError: DataLoader worker (pid(s) 13615) exited unexpectedly 
Python :: asserts pytest for function called more than once 
Python :: Assigning X and y using .iloc index 
Python :: python integrated with activeX 
Python :: python get function from string name 
Python :: dask dataframe csv tutorial 
Python :: can i register a list in python for input 
Python :: roganrola 
Python :: python resample time series 
Python :: python fibonacci while loop 
Python :: duplicate characters in a string python 
Python :: how to execute queries with cxoracle python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =