for (int i = 0; i < number_processes; i++){
while (read(fps[i][0], &each_record_read, sizeof(struct rec)) > 0){
if (records_container[i] == NULL){
records_container[i] = &each_record_read;
}
} // I want to do something to records_container here.
}
I have a program that its purpose is for the parent process to read data from each pipe that connects to several children.
I have define an array called records_container that contains each data type that I am going to read from the pipe, and I want to do something to this array after the while loop.
My question is this: when parent is loading data to records_container this array, is parent loading speed fast enough so that when I want to do something to records_container, I can always make sure all data is already being loaded perfectly?
Let's assume records_container is {0, 0, 0, 0} in this case (I know I want to load struct rec, but this doesn't matter really), the ideal situation that I want it to happen is that I want to deal with the loaded array, which is {1, 2, 3, 4} in this case, will parent read each number fast enough (which is 1, 2, 3, 4 from each pipe in this case) so that I won't deal with something like {1, 2, 0, 0}, or {1, 0, 0, 0} ... that kind stuff?