A few points to rectify your implementation.
1) Pass the production value as input to the threads while creating them. (Arg 4 in pthread_create)
2) Create worker threads as well that will package.
3) You are waiting for A to finish before B works. This is useless. Where is multithreaded then?
All the three production threads should be running in parallel as well as the two packaging threads. You can put thread_join near end of main just to make sure that threads do their work before you free resources and exit. Although this is not initially needed but must be done in a rightly design system
4) If you are not restricted from using other options for communicating between threads, then you may use FIFOs as the buffers for each production thread else
4b) a counter against each production line, whereby productionline will increment it, while the worker will decrement that (protected through semaphore) can be used for simulation. I'll recommend using fifos so that you learn more about multithreaded systems.
5) To make sure that the worker threads don't often get units from two lines, while 3rd gets halted, you can decide which one to pick based upon the ratio of number of units in a buffer and its capacity weighted by its speed. Higher ratio will mean, this line should be packed first.
6) Since packs are in units of 6, so you shouldn't pick a line if it has very less number of units in buffer.
7) You should make a couple of assumptions
a) Packs are for 6 units but those units can't be from different production lines (Else theoretically problem will be simplified much
but in a real environment that won't be the case usually).
b) Input parameters to the programs should be multiples of 6 (for each production line)
c) Wroker should not sit empty
d) Production lines would start at the same time but anyone can finish first. (implied assumption)