On 11 Nov 2015, at 11:46, Motti Shneor <su...@bezeqint.net> wrote:

> I have an NSOutputStream created and scheduled on some pre-created NSTrhead’s 
> NSRunloop (a.k.a mySocketThread). 
> 
> …
> 
> I have special difficulty with operation cancellation. I can (of course) 
> cancel scheduled messages that didn’t start, but I cannot (server protocol) 
> send half-messages to my server - hence I can only abort a cancelled 
> operation if stream error or end occurred (again - I can only know this via 
> stream events).

In this situation I'd introduce a lay of abstraction between your stream and 
your operations.  That is, have all the code that's managing your stream run on 
the run loop, where it's serialised and life is sane.  That code would be 
responsible for all the framing and unframing of messages, presenting an 
abstraction that's entirely message based.  Then have your NSOperation code 
talk to that via some sort of inter-thread messaging.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to