I am using (and am required to use) a third-party framework to which I do not have source. The third-party framework handles creating an authenticated client/server connection and hands back a pair of open NSStreams.
The stream creation process, per Apple's docs, is: alloc/init, set delegate, schedule in run loop, and open. Apple's docs go further to say: "You should never attempt to access a scheduled stream from a thread different than the one owning the stream’s run loop." https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html#//apple_ref/doc/uid/20002273-1001844
The stream disposal process is: close, unschedule, release.
If one creates a stream themselves, it's clear where the stream was scheduled. If a third-party framework creates the stream, one may not know where the stream was scheduled.
Looking at the documentation that I found, I did not see a way to programmatically determine the NSRunLoop and NSThread with which an open NSStream is associated. Is there a way to determine this information at runtime?
NSInput
/OutputStream
or a custom subclass? – Soybean