Fix previous change to compile again when using select() instead of poll().

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35182 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2012-06-07 08:11:59 +00:00
parent 6e59f141f5
commit 59df115b26
2 changed files with 35 additions and 32 deletions

View file

@ -1,3 +1,8 @@
2012-06-07 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/unix/GSRunLoopCtxt.m (-pollUntil:within:): Fix previous
change to compile again when using select() instead of poll().
2012-06-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSocketPort.m:

View file

@ -398,8 +398,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
{
fd = port_fd_array[port_fd_count];
setPollfd(fd, POLLIN, self);
NSMapInsert(_rfdMap,
(void*)(intptr_t)port_fd_array[port_fd_count], info);
NSMapInsert(_rfdMap, (void*)(intptr_t)fd, info);
}
if (port_fd_array != port_fd_buffer) free(port_fd_array);
}
@ -507,13 +506,13 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
}
/*
* Look at all the file descriptors select() says are ready for action;
* Look at all the file descriptors poll() says are ready for action;
* notify the corresponding object for each of the ready fd's.
* NB. It is possible for a watcher to be missing from the map - if
* the event handler of a previous watcher has 'run' the loop again
* before returning.
* NB. Each time this loop is entered, the starting position (fairStart)
* is incremented - this is to ensure a fair distribion over all
* is incremented - this is to ensure a fair distribution over all
* inputs where multiple inputs are in use. Note - fairStart can be
* modified while we are in the loop (by recursive calls).
*/
@ -806,7 +805,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
NSInteger port_fd_size = FDCOUNT;
NSInteger port_fd_count = FDCOUNT;
NSInteger port_fd_buffer[FDCOUNT];
NSInteger port_fd_array = port_fd_count;
NSInteger *port_fd_array = port_fd_buffer;
[port getFds: port_fd_array count: &port_fd_count];
while (port_fd_count > port_fd_size)
@ -822,11 +821,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
while (port_fd_count--)
{
fd = port_fd_array[port_fd_count];
FD_SET (port_fd_array[port_fd_count], &read_fds);
if (fd > fdEnd)
fdEnd = fd;
NSMapInsert(_rfdMap,
(void*)(intptr_t)port_fd_array[port_fd_count], info);
FD_SET (fd, &read_fds);
NSMapInsert(_rfdMap, (void*)(intptr_t)fd, info);
}
if (port_fd_array != port_fd_buffer) free(port_fd_array);
}
@ -892,28 +890,28 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
GSRunLoopWatcher *watcher;
watcher = (GSRunLoopWatcher*)GSIArrayItemAtIndex(_trigger, count).obj;
if (watcher->_invalidated == NO)
{
i = [contexts count];
while (i-- > 0)
{
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
if (watcher->_invalidated == NO)
{
i = [contexts count];
while (i-- > 0)
{
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
if (c != self)
{
[c endEvent: (void*)watcher for: watcher];
}
}
/*
* The watcher is still valid - so call its
* receivers event handling method.
*/
[watcher->receiver receivedEvent: watcher->data
type: watcher->type
extra: watcher->data
forMode: mode];
}
GSPrivateNotifyASAP(mode);
if (c != self)
{
[c endEvent: (void*)watcher for: watcher];
}
}
/*
* The watcher is still valid - so call its
* receivers event handling method.
*/
[watcher->receiver receivedEvent: watcher->data
type: watcher->type
extra: watcher->data
forMode: mode];
}
GSPrivateNotifyASAP(mode);
}
/*
@ -924,12 +922,12 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
completed = YES;
return NO;
}
/*
* Look at all the file descriptors select() says are ready for action;
* notify the corresponding object for each of the ready fd's.
* NB. Each time this roop is entered, the starting position (fairStart)
* is incremented - this is to ensure a fair distribtion over all
* NB. Each time this loop is entered, the starting position (fairStart)
* is incremented - this is to ensure a fair distribution over all
* inputs where multiple inputs are in use. Note - fairStart can be
* modified while we are in the loop (by recursive calls).
*/