In Cocoa, I've setup two NSThreads, one producer and one consumer. The producer appends data to an NSMutableData, and the receiver opens an NSInputStream from that data and reads in chunks.
The producer thread writes a lot faster than the consumer processes, which is OK. But the producer only produces a finite amount of work, then exits. I'd like for the consumer thread to handle the NSStreamEventEndEncountered event. How can I signal this when the NSInputStream comes from an NSMutableData?
Should I just make the producer send a series of bytes with a magical number signifying an end of stream?