[launchd-dev] WatchPaths

Quinn eskimo1 at apple.com
Thu Feb 18 09:41:12 PST 2010


At 10:43 -0500 18/2/10, Brian Hanson wrote:
>The receiving folder could have hundreds of files in it, so 
>iterating through the folder, looking at mod dates, etc, wouldn't be 
>stable enough.

launchd watches directories via a kqueue, which doesn't tell launchd 
about the item that changed.  Thus, the answer is no.  You will have 
to look at the directory and work out what to do.

But you have to do that anyway.  Even if the launchd told you about 
the changes it saw, you'd still have to deal with race condition I 
described in my previous email.

Ultimately you need to think of launchd's launch-on-demand mechanism 
as being 'level triggered'.  The job doesn't hear about specific 
events, it hears about the existence of a certain state.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list