Re: GCD code in plain old C, and a correctness question
Re: GCD code in plain old C, and a correctness question
- Subject: Re: GCD code in plain old C, and a correctness question
- From: David Leimbach <email@hidden>
- Date: Tue, 8 Sep 2009 08:22:11 -0700
On Tue, Sep 8, 2009 at 12:05 AM, Kevin Van Vechten
<email@hidden> wrote:
On Sep 7, 2009, at 7:56 PM, David Leimbach wrote:
Aside from having to bump up my file descriptors to run this code, I'm not sure why I'm getting "????" at the end of the code linked here:
Otherwise it appears to function properly.
I'm basically writing a concurrent prime number sieve using libdispatch data structures, and using pipe fds to sort of simulate an "actor message passing style" by tying together event sources on the read end of a pipe pair of fds. Since none of the sources or contexts know when the computation is complete by the amount of data they've received, I send a -1 through the entire sieve of blocks to cause shutdown to occur. ) If you look at my earlier versions of this code, I was using a sleep call). Even this new version of the code seems to function up until the "????".
I'm trying to decide if this is a bug on my part or not.
Also, running this without bumping the ulimit for fds caused my Snow Leopard machine to kernel panic just once. So if you run this, please do so with that caveat. I've been as of yet unable to reproduce this crash, but I'll file a bug report if I do.
I believe the "????" is the result of writing (int)-1 to stdout.
Actually it's much worse. I had used calloc to allocate the context, which had the write fd. I had written -1 to "stdin" (0 is stdin right?)
Writing to stdin causes the console to barf up ?'s ? My program is wrong, but that's interesting behavior all the same.
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden