This is not entirely Cocoa, it is java, but it involves ObjectiveC JNI, the 
java native interface. 
Also a little bit of a long story, my apologies.
Specifically the question concerns kqueue, my code is based on the Uli Kusterer 
ObjectiveC interface to that. 
 Java nio.2 introduced the WatchService class, this monitors directories and 
tells you of any file system changes.
For OS X the implementation is a pure java polling one. Unlike about every 
other platform where they are native based.
I tried to write a native OS X one based on kqueue.
I got it so that it passes the nio.2 Basic WatchService tests. 
There is another set of tests for the code under load. LotsOfEvents. I ran into 
what seems a deadlock condition between the java code and the kqueue code. 
Left it at that months if not years ago, but the code was sitting up on github.
I noticed someone had recently forked it. I looked at their fork out of 
curiosity and they said LotOfEvents ran. 
I figured some minor miracle had occurred. I finally sat down and looked at it 
today and unfortunately it is just that I left the code in a state where it 
didn’t do the actual test to see if it was successful, which it is not, but 
instead just runs through and finishes without indicating any errors. So it 
just looked like it worked.

What the test code does is fire a lot of events. It processes what it has and 
then waits to see if it gets more. 

For some reason while it waits for more events kqueue stops posting events 
entirely.  If you check for anything returned the test fails.
If you don’t, but let the test to continue to run. kqueue happily resumes 
pumping events with the debug messages making it look like it works.

Any thoughts? I thought I’d ask here before I spend a whole lot of time (or 
LotsOfTime) spinning wheels back at square 1 again.

Michael Hall




_______________________________________________

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

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

Reply via email to