Last active
June 26, 2021 19:24
-
-
Save scalactic/a59af96b1e62dc04a6e558f873fabc84 to your computer and use it in GitHub Desktop.
Getting python process return value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process, Value | |
def func(val): | |
val.value = val.value * 2 | |
return True | |
if __name__ == '__main__': | |
val = Value("l", 1, lock=False) # "l" -> typecode_or_type , 1 -> the value. | |
proc = Process(target=func, args=(val,)) | |
proc.start() | |
proc.join() | |
print(val.value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment