Re: kqueue OK in 10.4, not calling back to CFSocket in 10.3
Re: kqueue OK in 10.4, not calling back to CFSocket in 10.3
- Subject: Re: kqueue OK in 10.4, not calling back to CFSocket in 10.3
- From: Greg Herlihy <email@hidden>
- Date: Sat, 25 Feb 2006 22:36:32 -0800
- Thread-topic: kqueue OK in 10.4, not calling back to CFSocket in 10.3
I have one suggestion although I give it little chance of fixing the
problem: I noticed that the CocoaDirWatcher project is built against the
current Mac OS. I also figure that the current Mac OS in the builds tested
must have been 10.4 since building against the 10.3.9 SDK headers fails with
a compilation error (which can be fixed by having AppController.m include
<sys/fnctl.h> for its O_RDONLY define).
The theory behind this idea is that building the app against the 10.4
frameworks, libraries and headers is causing some kind of problem when
running the app on Panther. Unfortunately, not having a machine with a
Panther OS installed I was unable to first test this suggestion myself. I
was able to confirm however that running a version of CocoaDirWatcher built
against the 10.3.9 SDK continues to run correctly under Tiger.
Greg
On 2/25/06 7:20 PM, "Jerry Krinock" <email@hidden> wrote:
> In "Advanced Mac OS X Programming" by Dalrymple & Hillegass, there is an
> example project which monitors directory changes with a kqueue in a CFSocket
> that is added to your main run loop. I like this method because, in my
> religion, we avoid spawning threads whenever possible.
>
> It works fine in Tiger, and it compiles and runs fine in Panther, but in
> Panther I never get a callback when the directory changes; it "just doesn't
> work". (The example project in the book behaves the same way, and Mark D.
> told me he has reproduced the issue and would look into it, but the answer
> is not obvious to either of us.)
>
> I have confirmed the following in Panther:
> kqueue returns a file descriptor, OK.
> CFSocketCreateWithNative creates socket, OK.
> CFSocketCreateRunLoopSource creates source, OK.
> CFRunLoopGetCurrent returns run loop, OK.
> After CFRunLoopAddSource, CFRunLoopContainsSource
> confirms that my source has been added.
> Adding a call to CRFRunLoopWakeUp does not help.
> Adding an observer shows that loop does cycle through
> in Tiger when the watched directory is changed,
> but does not cycle through in Panther.
>
> There is also a command-line project in the book which works fine in both
> Tiger and Panther. It camps on the kevent() with a "while" loop. So, I'd
> say it is the CFSocket mechanism which is failing.
>
> Does anyone know of any bugs in Panther's kqueue or CFSocket which could
> cause this failure?
>
> Jerry Krinock
>
> P.S. I pondered for a long time whether to post this to Carbon-dev or
> Cocoa-dev. It seems there should be a "CoreFoundation-dev" list.
>
> The example projects can be downloaded from the book's web site:
>
> http://www.borkware.com/corebook/second-edition-files/15-kqueues.tar.gz
>
> The command-Line project which does work OK is "dirwatcher".
> The project using CFSocket which does not work is "CocoaDirWatcher".
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden