Skip to content

Instantly share code, notes, and snippets.

@scalactic
Last active June 26, 2021 19:24
Show Gist options
  • Save scalactic/a59af96b1e62dc04a6e558f873fabc84 to your computer and use it in GitHub Desktop.
Save scalactic/a59af96b1e62dc04a6e558f873fabc84 to your computer and use it in GitHub Desktop.
Getting python process return value
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