Hello, all ...

I'm trying to implement a progressive download / cache using 
CFReadStreamCreateWithFile() to open a file URL that another thread is writing 
to. Basically, I have one thread with an NSURLConnection downloading a URL, and 
it's didReceiveData writes the data to the file via an NSFileHandle. Meanwhile, 
i've another thread that is trying to open this file via 
CFReadStreamCreateWithFile() to play it back. The idea is that the thread with 
the NSURLConnection can write the data to the file as fast as it gets it, and 
the thread with the CFReadStream can consume it at it's leisure (like, say, the 
audio playback rate).

What i'm seeing is that the CFReadStreamCreateWithFile() always returns nil 
when given the file URL that the other thread has open and is writing to, yet 
returns a stream if the file isn't already open. Is there a way I can make a 
CFReadStream with non-exclusive access to an already open file, or do I need to 
go down to the BSD open() call with SHLOCK to do this? Or is there another way? 
Any help is appreciated :-)

Regards,

John


 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to