I have this situation:
The main process will generate some subprocess so that they must write the result to a common object in string and numeric types, there are no problems for numeric types, but the value will be lost with the string.
import multiprocessing as mp from ctypes import Structure, c_double, c_wchar_p, c_int
As a result, the field in the shared object containing c_double is written to the field, but the line generated in the rum-mp subprocesses ( string values[i].name = str( i ) ) will be lost in the main process.
Is there a method for storing strings generated in a subprocess?
the output of this code is as follows:
If the resulting row in the main process is completely random.
tmp: 0 tmp: 2 tmp: 3 tmp: 4 res name: ηΎ ηΎres val: 0.000000 res name: ηΎ ηΎres val: 1.000000 res name: res val: 2.000000 ....
Giggi source share