diff --git a/VDKQueue.h b/VDKQueue.h index 9856a34..87b6923 100644 --- a/VDKQueue.h +++ b/VDKQueue.h @@ -116,15 +116,6 @@ extern NSString * VDKQueueAccessRevocationNotification; @interface VDKQueue : NSObject -{ - id _delegate; - BOOL _alwaysPostNotifications; // By default, notifications are posted only if there is no delegate set. Set this value to YES to have notes posted even when there is a delegate. - -@private - int _coreQueueFD; // The actual kqueue ID (Unix file descriptor). - NSMutableDictionary *_watchedPathEntries; // List of VDKQueuePathEntries. Keys are NSStrings of the path that each VDKQueuePathEntry is for. - BOOL _keepWatcherThreadRunning; // Set to NO to cancel the thread that watches _coreQueueFD for kQueue events -} // @@ -139,12 +130,14 @@ extern NSString * VDKQueueAccessRevocationNotification; - (void) removePath:(NSString *)aPath; - (void) removeAllPaths; +/// Returns the number of paths that this VDKQueue instance is actively watching. +- (NSUInteger) numberOfWatchedPaths; -- (NSUInteger) numberOfWatchedPaths; // Returns the number of paths that this VDKQueue instance is actively watching. +@property (nonatomic, assign) id delegate; +/// By default, notifications are posted only if there is no delegate set. Set this value to YES to have notes posted even when there is a delegate. +@property (nonatomic, assign) BOOL alwaysPostNotifications; -@property (assign) id delegate; -@property (assign) BOOL alwaysPostNotifications; -@end \ No newline at end of file +@end diff --git a/VDKQueue.m b/VDKQueue.m index f1bc83b..94f4b3f 100644 --- a/VDKQueue.m +++ b/VDKQueue.m @@ -20,6 +20,7 @@ // distribution. #import "VDKQueue.h" +#import #import #import #include @@ -43,11 +44,6 @@ // This is a simple model class used to hold info about each path we watch. @interface VDKQueuePathEntry : NSObject -{ - NSString* _path; - int _watchedFD; - u_int _subscriptionFlags; -} - (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags; @@ -58,10 +54,15 @@ - (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags; @end @implementation VDKQueuePathEntry +{ + NSString* _path; + int _watchedFD; + u_int _subscriptionFlags; +} @synthesize path = _path, watchedFD = _watchedFD, subscriptionFlags = _subscriptionFlags; -- (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags; +- (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags { self = [super init]; if (self) @@ -113,6 +114,15 @@ - (void) watcherThread:(id)sender; @implementation VDKQueue +{ +@private + /// The actual kqueue ID (Unix file descriptor). + int _coreQueueFD; + /// List of VDKQueuePathEntries. Keys are NSStrings of the path that each VDKQueuePathEntry is for. + NSMutableDictionary *_watchedPathEntries; + /// Set to NO to cancel the thread that watches _coreQueueFD for kQueue events + BOOL _keepWatcherThreadRunning; +} @synthesize delegate = _delegate, alwaysPostNotifications = _alwaysPostNotifications; @@ -205,8 +215,6 @@ - (VDKQueuePathEntry *) addPathToQueue:(NSString *)path notifyingAbout:(u_int)fl return [[pathEntry retain] autorelease]; } - - return nil; }