pthread question how would I init this data structure?

This is a discussion on pthread question how would I init this data structure? within the C Programming forums, part of the General Programming Boards category; Hi guys,
I'm very new to pthreads and I'm not sure exactly how I would init this data structure.
I ...

Now would I simply use malloc? I'm confused because I have a thread_work data structure and a tpool data structure. I'm assuming the tpool data structure is where I would use the poolSize. perhaps in a for loop or would i simply set the tp->num_threads = poolSize and not use malloc at all?. And the thread_work thread I think I would just use malloc once right?

Hi thanks for the responce, well the program will do the following:
it will take an unsorted input and writes it to a file in the proper order. The threads have their own local store of buffers that they have read, but otherwise share access to the source pipe, destination file, the index of the current entry to write, and the index of the last entry.

The main function in the receiver will call two functions that create and manage threads for this project: thread_pool_init, which initializes the tpool_t data structure, and run_pool_threads, which creates the threads that run the function rcv_file. Initially, create one such thread, but ultimately six threads must be run.

When a thread reads a line, the line is placed in a store. These stores are of limited size, so the you must ensure that a store does not overflow. If a store becomes full, then you must cause thread to wait until it has the next_entry line before it can proceed. I will make sure that the input file does not cause all stores to fill.

I'm not sure if this helps at all, the professor supplied the library code but didn't explain how they correlate and I was hoping any of you could take a guess at what it might be doing there.

He mentioned this:
#

With a single thread, you can put the mutual exclusion code in to protect the shared data structures. You must identify these shared data structures and add the appropriate pthreads code for mutual exclusion. The variables for mutual exclusion are provided in the data structure tpool_t.
#

Then, try two threads at a time. In this case, you will need to use a condition variable for a thread to wait and be awoken. The condition variable is also defined in tpool_t.

So to answer your question, can that pointer be used to perhaps switch between threads in the pool thread? LIke that thread pointer will point to the active thread?