git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14243 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-08-07 15:30:03 +00:00
parent a702331098
commit 91b76f496f
6 changed files with 77 additions and 107 deletions

View file

@ -274,6 +274,11 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
* NSNotificationQueue class implementation
*/
@interface NSNotificationQueue (Private)
- (void) _postNotification: (NSNotification*)notification
forModes: (NSArray*)modes;
@end
@implementation NSNotificationQueue
+ (NSNotificationQueue*) defaultQueue
@ -432,19 +437,6 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
}
}
- (void) postNotification: (NSNotification*)notification
forModes: (NSArray*)modes
{
NSString *mode = [[NSRunLoop currentRunLoop] currentMode];
// check to see if run loop is in a valid mode
if (mode == nil || modes == nil
|| [modes indexOfObject: mode] != NSNotFound)
{
[_center postNotification: notification];
}
}
- (void) enqueueNotification: (NSNotification*)notification
postingStyle: (NSPostingStyle)postingStyle
{
@ -468,7 +460,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
switch (postingStyle)
{
case NSPostNow:
[self postNotification: notification forModes: modes];
[self _postNotification: notification forModes: modes];
break;
case NSPostASAP:
add_to_queue(_asapQueue, notification, modes, _zone);
@ -481,6 +473,23 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
@end
@implementation NSNotificationQueue (Private)
- (void) _postNotification: (NSNotification*)notification
forModes: (NSArray*)modes
{
NSString *mode = [[NSRunLoop currentRunLoop] currentMode];
// check to see if run loop is in a valid mode
if (mode == nil || modes == nil
|| [modes indexOfObject: mode] != NSNotFound)
{
[_center postNotification: notification];
}
}
@end
/*
* The following code handles sending of queued notifications by
* NSRunLoop.
@ -500,7 +509,7 @@ static inline void notifyASAP(NSNotificationQueue *q)
NSArray *modes = item->modes;
remove_from_queue_no_release(list, item);
[q postNotification: notification forModes: modes];
[q _postNotification: notification forModes: modes];
RELEASE(notification);
RELEASE(modes);
NSZoneFree(((accessQueue)q)->_zone, item);
@ -535,7 +544,7 @@ static inline void notifyIdle(NSNotificationQueue *q)
NSArray *modes = item->modes;
remove_from_queue_no_release(list, item);
[q postNotification: notification forModes: modes];
[q _postNotification: notification forModes: modes];
RELEASE(notification);
RELEASE(modes);
NSZoneFree(((accessQueue)q)->_zone, item);