why do we use while(1)?
int fd[2];
int write_val = 1;
void send_one(int signal) {
    write(fd[1], &write_val, sizeof(int));
}
int main() {
    pipe(fd);
    int pid = fork();
    if (pid == 0) {
        close(fd[0]);
        struct sigaction sa;
        sa.sa_handler = send_one;
        sa.sa_flags = 0;
        sigemptyset(&sa.sa_mask);
        sigaction(SIGUSR1, &sa, NULL);
        while (1)
            ;
    } else if (pid > 0) {
        close(fd[1]);
        int count = 0;
        while (1) {
            int num = 0;
            int num_read = read(fd[0], &num, sizeof(int));
            if (num_read == sizeof(int) && num == 1) {
                count++;
                printf("%d\n", count);
            }
        }
    }
    return 0;
}