Re: Context in GCD source cancel handler?
Re: Context in GCD source cancel handler?
- Subject: Re: Context in GCD source cancel handler?
- From: Dave Zarzycki <email@hidden>
- Date: Thu, 06 Jan 2011 13:31:10 -0800
Jonathon,
Please don't use SIGPIPE. That's just a hack from the 1970s to make simple command line programs die when their input goes away. Instead, please call signal(SIGPIPE, SIG_IGN) right inside of main(). Thereafter, Unix APIs like read(), write(), etc will return -1 and errno will be equal to EPIPE.
davez
On Jan 6, 2011, at 1:22 PM, Jonathon Kuo wrote:
> On Jan 6, 2011, at 1:15 PM, Fritz Anderson wrote:
>
>> Taking "by value" to mean "as many uninterpreted bits as will fit into a variable of type void*," yes.
>
> On Jan 6, 2011, at 1:14 PM, Dave Zarzycki wrote:
>
>> Yes, that is the nature of void *. Nothing can be known about a void * other than the value – therefore you can store anything there (even non-pointers as long as they are <= sizeof(void *)).
>
> Awesome! I get it now. This all came about because I am getting an occasional SIGPIPE when one of my read sources is closed on the client end, so having a context is great. Thanks!!
>
> BTW, is there an inherent signal-handling capability with GCD so my program doesn't get blown out of the water when a SIGPIPE happens?
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden