1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Issues with synchronization with multiprocessing.Lock

Discussão em 'Python' iniciado por Stack, Setembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I am initializing multiprocessing.Lock() in a worker process. like: with multiprocessing.Lock(): shared_value+=1 is it any different passing a single instance from the parent process through all worker processes? Does it cause sync issues. Cause I can see shared_value becoming ambiguous values.

    I tried passing a single instance of Lock() through all the workers and it doesnt cause it. Also do I require to create a Pool since I am creating each process, starting each in a loop and store it in a list. And I use the list to calll process.join() each in a loop in the end. What does creating a Pool do here?

    Continue reading...

Compartilhe esta Página