in reply to Re: Re: Re: thread:shared
in thread thread:shared

I enterd in the Reader the line:
next if ($NoClient < 2);
for speed and for 'economical' reasons. If only 1 Client is 'chatting' that would mean (for my purpos: sending results that have to be added to file - this part I elimiated), that there is no need to push anything into @chat.

But you just can skip this line without any side effects. @chat would only be a bit bigger and the Writer is called just to eliminate those lines: I think the Writer gets a signal on (or by?) cond_wait, he will try to send those lines but won't send them because the lines are from his corresponding reader, then those lines are deleted.

This cannot be responsible for the fact that some time ago sometimes a Writer did not die. The Reader leaves the loop when his socket broke, then outeside the loop he is pushing the 'kill-code' into @chat and this should call the Writer. He detects the 'kill-code' together with his ID and he will leave the loop. Due to the fact that he is the last to die, the Writer does all the admin stuff, I think it's usefull that way.
carl