Skip to content
Advertisement

Tag: wait

Wait for signal, then continue execution

I am trying to make a program that suspends its execution until a signal arrives. Then, after the signal arrives I just want my code to continue its execution from where it was. I don’t want it to execute a function handler or whatsoever. Is there a simple way of doing this? I have been struggling for a week or

Can someone please explain how this works?fork(),sleep()

What is happening here? How is sleep() getting executed in the for loop? When is it getting called? Here is the output: Please explain this output. I am not able to understand how it’s working. Step by step analysis would be great. Answer In the first loop, the original (parent) process forks 10 copies of itself. Each of these child

C wait3() int* status or int* stat_loc

I indeed to use wait3(). I have been looking what exactly is status/stat_loc but I couldn’t find it anywhere. Any explanation is greatly appreciated! Answer man wait explains the semantics of status:

Wait until a certain process (knowing the “pid”) end

I have this: Then i do this: I think this is not the best way to wait for the process to terminate, there must be some function wait or something, but i can’t find it. Disclaimer: The process is not a child process Answer I’m not really a Python programmer, but apparently Python does have os.waitpid(). That should consume less

Advertisement