New to python so this might sound like a basic question. I have a new process spawn off the main process to do something in parallel with the main process. I cannot use threads in this specific case cause of some underlining APIs threading issues. I am trying to achieve some synchronization among both the processes. I read about signals but I couldn't find a proper example which aligns with my case. Some example code:
import multiprocessing
import signal
def process_one(self):
# Do something
second_process = Process(target=self.process_two)
second_process.start()
# Do something and send signal to process_two to unpause
# Do other things
second_process.join()
def process_two(self):
# Do something
# Now I want to pause this process till I receive a signal from
# process_one
signal.pause()
# continue to do other things
As I have mentioned in the comments, I am trying to figure out a way to achieve this. Most of the examples I saw were for forks
. Pointers?
Solved it using Event()
The example posted there was exactly what I wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With