简体   繁体   中英

Linux c process synchronization only signals and message queues

I'm looking for help with synchronization of 3 child processes and their parent. I have 3 child processes, 1st is reading from file lines and sending them via pipe to 2nd, 2nd process receives it, counts how many characters it is and that number sends via second pipe to 3rd process which one prints it to console.

Now I have to use signals and message queues to handle SIGTERM, SIGCONT and SIGTSTP. The scenario looks like this: Only 3rd process reacts to signals send from console. After receiving he 'informs' parent. Parent saves signal to message queue and 'informs' 1st child. 1st child reads, saves, informs 2nd and 2nd same for 3rd.

I have already made all of it with sigaction() siginfo_t etc., but what I can't figure out is how to make process to wait for another. I read about wait(),waitid(),waitpid(), but all of them seems to be used only for child process.

I need tool which can stop process till another process specified by ID do something.

我希望我理解了这个问题,但是我想您需要这样的东西: 子进程可以等待父进程在C语言中的Linux编程中终止吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM