pass more info to notification functions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29068 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-11-27 07:53:38 +00:00
parent 48499df0dd
commit e0c9ae4e2d
6 changed files with 43 additions and 31 deletions

View file

@ -1,3 +1,13 @@
2009-11-27 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSNotificationQueue.m:
* Source/NSRunLoop.m:
* Source/unix/GSRunLoopCtxt.m:
* Source/win32/GSRunLoopCtxt.m:
* Source/GSPrivate.h:
Pass current runloop mode to notification functions. Next we need
to add code to use this information.
2009-11-26 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPropertyList.m: Revert last change, which broke XML

View file

@ -402,17 +402,17 @@ GSPrivateNativeCStringEncoding() GS_ATTRIB_PRIVATE;
/* Function used by the NSRunLoop and friends for processing
* queued notifications which should be processed at the first safe moment.
*/
void GSPrivateNotifyASAP(void) GS_ATTRIB_PRIVATE;
void GSPrivateNotifyASAP(NSString *mode) GS_ATTRIB_PRIVATE;
/* Function used by the NSRunLoop and friends for processing
* queued notifications which should be processed when the loop is idle.
*/
void GSPrivateNotifyIdle(void) GS_ATTRIB_PRIVATE;
void GSPrivateNotifyIdle(NSString *mode) GS_ATTRIB_PRIVATE;
/* Function used by the NSRunLoop and friends for determining whether
* there are more queued notifications to be processed.
*/
BOOL GSPrivateNotifyMore(void) GS_ATTRIB_PRIVATE;
BOOL GSPrivateNotifyMore(NSString *mode) GS_ATTRIB_PRIVATE;
/* Function to return the function for searching in a string for a range.
*/

View file

@ -565,7 +565,8 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
* NSRunLoop.
*/
static inline void notifyASAP(NSNotificationQueue *q)
static inline void
notifyASAP(NSNotificationQueue *q, NSString *mode)
{
NSNotificationQueueList *list = ((accessQueue)q)->_asapQueue;
@ -587,7 +588,7 @@ static inline void notifyASAP(NSNotificationQueue *q)
}
void
GSPrivateNotifyASAP()
GSPrivateNotifyASAP(NSString *mode)
{
NotificationQueueList *item;
@ -595,12 +596,13 @@ GSPrivateNotifyASAP()
{
if (item->queue)
{
notifyASAP(item->queue);
notifyASAP(item->queue, mode);
}
}
}
static inline void notifyIdle(NSNotificationQueue *q)
static inline void
notifyIdle(NSNotificationQueue *q, NSString *mode)
{
NSNotificationQueueList *list = ((accessQueue)q)->_idleQueue;
@ -622,11 +624,11 @@ static inline void notifyIdle(NSNotificationQueue *q)
/*
* Post all ASAP notifications.
*/
notifyASAP(q);
notifyASAP(q, mode);
}
void
GSPrivateNotifyIdle()
GSPrivateNotifyIdle(NSString *mode)
{
NotificationQueueList *item;
@ -634,13 +636,13 @@ GSPrivateNotifyIdle()
{
if (item->queue)
{
notifyIdle(item->queue);
notifyIdle(item->queue, mode);
}
}
}
BOOL
GSPrivateNotifyMore()
GSPrivateNotifyMore(NSString *mode)
{
NotificationQueueList *item;

View file

@ -985,7 +985,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
else if ([(d=timerDate(t)) timeIntervalSinceReferenceDate] <= now)
{
[t fire];
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(_currentMode);
IF_NO_GC([arp emptyPool]);
updateTimer(t, d, now);
}
@ -1010,7 +1010,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
{
GSIArrayRemoveItemAtIndexNoRelease(timers, i);
[t fire];
GSPrivateNotifyASAP(); /* Post notifications. */
GSPrivateNotifyASAP(_currentMode); /* Post notifications. */
IF_NO_GC([arp emptyPool]);
if (updateTimer(t, d, now) == YES)
{
@ -1154,8 +1154,8 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
&& GSIArrayCount(context->timers) == 0))
{
NSDebugMLLog(@"NSRunLoop", @"no inputs or timers in mode %@", mode);
GSPrivateNotifyASAP();
GSPrivateNotifyIdle();
GSPrivateNotifyASAP(_currentMode);
GSPrivateNotifyIdle(_currentMode);
/* Pause until the limit date or until we might have
* a method to perform in this thread.
*/
@ -1165,7 +1165,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
{
[self _checkPerformers: context];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(_currentMode);
_currentMode = savedMode;
RELEASE(arp);
NS_VOIDRETURN;
@ -1201,10 +1201,10 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
}
if ([context pollUntil: timeout_ms within: _contextStack] == NO)
{
GSPrivateNotifyIdle();
GSPrivateNotifyIdle(_currentMode);
}
[self _checkPerformers: context];
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(_currentMode);
_currentMode = savedMode;
/* Once a poll has been completed on a context, we can remove that

View file

@ -411,7 +411,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
* we can service the queue. Similarly, if a task has completed,
* we need to deliver its notifications.
*/
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
if (GSPrivateCheckTasks() || GSPrivateNotifyMore(mode) || immediate == YES)
{
milliseconds = 0;
}
@ -491,7 +491,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: watcher->data
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
}
/*
@ -566,7 +566,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(uintptr_t)fd
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break; // A nested poll has done the job.
@ -598,7 +598,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(uintptr_t)fd
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break; // A nested poll has done the job.
@ -639,7 +639,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(uintptr_t)fd
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break; // A nested poll has done the job.
@ -837,7 +837,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
* we can service the queue. Similarly, if a task has completed,
* we need to deliver its notifications.
*/
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
if (GSPrivateCheckTasks() || GSPrivateNotifyMore(mode) || immediate == YES)
{
timeout.tv_sec = 0;
timeout.tv_usec = 0;
@ -904,7 +904,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: watcher->data
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
}
/*
@ -965,7 +965,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(intptr_t)fdIndex
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break;
@ -997,7 +997,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(intptr_t)fdIndex
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break;
@ -1038,7 +1038,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
extra: (void*)(intptr_t)fdIndex
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
if (completed == YES)
{
break;

View file

@ -386,7 +386,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
* we can service the queue. Similarly, if a task has completed,
* we need to deliver its notifications.
*/
if (GSPrivateCheckTasks() || GSPrivateNotifyMore() || immediate == YES)
if (GSPrivateCheckTasks() || GSPrivateNotifyMore(mode) || immediate == YES)
{
wait_timeout = 0;
}
@ -506,7 +506,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
extra: watcher->data
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
}
// if there are windows message
@ -569,7 +569,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
forMode: mode];
}
GSPrivateNotifyASAP();
GSPrivateNotifyASAP(mode);
completed = YES;
return YES;