this is my first attempt at threading in C. I am creating a circularly bounded buffer. I know how to create the thread, but all examples I have seen only have threaded functions that accept one void parameter, but unfortunately my worker's specification requires me to use three, as shown here:
void bufferRead(BoundedBuffer* buffer, char* data, int count) {
pthread_mutex_lock(&buffer->mutexBuffer);
<snip>
pthread_mutex_unlock(&buffer->mutexBuffer);
}
Here is my pthread_create statement
pthread_create(&buffer.readThread, NULL, (void *)bufferRead, &readParams)
And my readParams struct/assignments
struct readThreadParams {
BoundedBuffer b;
char* data;
int count;
};
struct readThreadParams readParams;
readParams.b = buffer2;
readParams.data = out_array;
readParams.count = in_size;
Any advice on how to assign each of the struct's parameters after passing to the bufferRead function would be greatly appreciated.