I'm trying to implement a pipelined multithreaded version of the grep command for a class project. The pipeline will have 5 stages and I need 4 buffers to hold filenames that are used between each stage. The buffersize is one of the arguments passed from the terminal when the command is called (i.e. ./pipelinegrep <buffsize> ...etc)
I'm completely lost as to how to create the buffers so that they can be used by different stages of a pipeline but not define the size of the buffer until the main method where I can use the arguments passed to the function call.
My initial thought was to pass the two buffers that a thread would use as the 4th argument for pthread_create, however this is only one argument so I don't know how to pass it two buffers.
I've got to finish this by tonight so any help would be much appreciated let me know if I wasn't clear enough on anything or if any other information would help.