mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
0687a031b1
commit
52e900d07c
2 changed files with 35 additions and 32 deletions
|
@ -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>
|
2012-06-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSSocketPort.m:
|
* Source/NSSocketPort.m:
|
||||||
|
|
|
@ -398,8 +398,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
||||||
{
|
{
|
||||||
fd = port_fd_array[port_fd_count];
|
fd = port_fd_array[port_fd_count];
|
||||||
setPollfd(fd, POLLIN, self);
|
setPollfd(fd, POLLIN, self);
|
||||||
NSMapInsert(_rfdMap,
|
NSMapInsert(_rfdMap, (void*)(intptr_t)fd, info);
|
||||||
(void*)(intptr_t)port_fd_array[port_fd_count], info);
|
|
||||||
}
|
}
|
||||||
if (port_fd_array != port_fd_buffer) free(port_fd_array);
|
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.
|
* 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
|
* 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
|
* the event handler of a previous watcher has 'run' the loop again
|
||||||
* before returning.
|
* before returning.
|
||||||
* NB. Each time this loop is entered, the starting position (fairStart)
|
* 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
|
* inputs where multiple inputs are in use. Note - fairStart can be
|
||||||
* modified while we are in the loop (by recursive calls).
|
* 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_size = FDCOUNT;
|
||||||
NSInteger port_fd_count = FDCOUNT;
|
NSInteger port_fd_count = FDCOUNT;
|
||||||
NSInteger port_fd_buffer[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];
|
[port getFds: port_fd_array count: &port_fd_count];
|
||||||
while (port_fd_count > port_fd_size)
|
while (port_fd_count > port_fd_size)
|
||||||
|
@ -822,11 +821,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
||||||
while (port_fd_count--)
|
while (port_fd_count--)
|
||||||
{
|
{
|
||||||
fd = port_fd_array[port_fd_count];
|
fd = port_fd_array[port_fd_count];
|
||||||
FD_SET (port_fd_array[port_fd_count], &read_fds);
|
|
||||||
if (fd > fdEnd)
|
if (fd > fdEnd)
|
||||||
fdEnd = fd;
|
fdEnd = fd;
|
||||||
NSMapInsert(_rfdMap,
|
FD_SET (fd, &read_fds);
|
||||||
(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);
|
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;
|
GSRunLoopWatcher *watcher;
|
||||||
|
|
||||||
watcher = (GSRunLoopWatcher*)GSIArrayItemAtIndex(_trigger, count).obj;
|
watcher = (GSRunLoopWatcher*)GSIArrayItemAtIndex(_trigger, count).obj;
|
||||||
if (watcher->_invalidated == NO)
|
if (watcher->_invalidated == NO)
|
||||||
{
|
{
|
||||||
i = [contexts count];
|
i = [contexts count];
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||||
|
|
||||||
if (c != self)
|
if (c != self)
|
||||||
{
|
{
|
||||||
[c endEvent: (void*)watcher for: watcher];
|
[c endEvent: (void*)watcher for: watcher];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The watcher is still valid - so call its
|
* The watcher is still valid - so call its
|
||||||
* receivers event handling method.
|
* receivers event handling method.
|
||||||
*/
|
*/
|
||||||
[watcher->receiver receivedEvent: watcher->data
|
[watcher->receiver receivedEvent: watcher->data
|
||||||
type: watcher->type
|
type: watcher->type
|
||||||
extra: watcher->data
|
extra: watcher->data
|
||||||
forMode: mode];
|
forMode: mode];
|
||||||
}
|
}
|
||||||
GSPrivateNotifyASAP(mode);
|
GSPrivateNotifyASAP(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -924,12 +922,12 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
||||||
completed = YES;
|
completed = YES;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look at all the file descriptors select() says are ready for action;
|
* Look at all the file descriptors select() says are ready for action;
|
||||||
* notify the corresponding object for each of the ready fd's.
|
* notify the corresponding object for each of the ready fd's.
|
||||||
* NB. Each time this roop is entered, the starting position (fairStart)
|
* NB. Each time this loop is entered, the starting position (fairStart)
|
||||||
* is incremented - this is to ensure a fair distribtion over all
|
* is incremented - this is to ensure a fair distribution over all
|
||||||
* inputs where multiple inputs are in use. Note - fairStart can be
|
* inputs where multiple inputs are in use. Note - fairStart can be
|
||||||
* modified while we are in the loop (by recursive calls).
|
* modified while we are in the loop (by recursive calls).
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue