Are the locks from the threading module interchangeable with those from the multiprocessing module?
Are the locks from the threading module interchangeable with those from the multiprocessing module?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can typically use the two interchangeably, but you need to cognizant of the differences. For example, multiprocessing.Event is backed by a named semaphore, which is sensitive to the platform under the application.
Multiprocessing.Lock is backed by Multiprocessing.SemLock – so it needs named semaphores. In essence, you can use them interchangeably, but using multiprocessing’s locks introduces some platform requirements on the application (namely, it doesn’t run on BSD :))