Search
 
SCRIPT & CODE EXAMPLE
 

C

wait system call

HC: hello from child
Bye
HP: hello from parent
CT: child has terminated
     (or)
HP: hello from parent
HC: hello from child
HC: Bye
CT: child has terminated    // this sentence does 
                            // not print before HC 
                            // because of wait.
Bye
Comment

wait system call

// C program to demonstrate working of wait()
#include<stdio.h>
#include<sys/wait.h>
#include<unistd.h>
 
int main()
{
    if (fork()== 0)
        printf("HC: hello from child
");
    else
    {
        printf("HP: hello from parent
");
        wait(NULL);
        printf("CT: child has terminated
");
    }
 
    printf("Bye
");
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: Example of header file c 
C :: send array to child process c 
C :: change no_turbo 
C :: c how to include variables of other c file 
C :: using tables as arguments in c++/c 
C :: String insertion into another string 
C :: why return 0 is written at the code end? 
C :: #include <stdio.h int main() { int x = 10, *y, **z; y = &x; z = &y; printf(""%d %d %d"", *y, **z, *(*z)); return 0; } 
C :: fscanf stops at space 
C :: C (Windows) 
C :: finding average of elements in array using struct in C? 
C :: Program optimization 
C :: float 
C :: Typecast Operator in C language 
C :: i2c scanner 
C :: robtex 
Dart :: screen size flutter 
Dart :: dart get String input from user 
Dart :: flutter appbar text color 
Dart :: card border radius in flutter 
Dart :: dart datetime difference 
Dart :: file picker flutter file size 
Dart :: flutter scroll to bottom 
Dart :: dart inset all 
Dart :: text field placeholder color flutter theme 
Dart :: how to disable windows build flutter 
Dart :: final vs const dart 
Dart :: dart read file 
Dart :: flutter listview how to remove scroll bar 
Dart :: flutter refresh page 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =