mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
cleanup getting descriptors/handles for ports.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31288 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
60c9ffa1ef
commit
5cd8a0e5cc
6 changed files with 49 additions and 42 deletions
|
@ -18,6 +18,8 @@
|
|||
#import "../GSRunLoopWatcher.h"
|
||||
#import "../GSPrivate.h"
|
||||
|
||||
#define FDCOUNT 128
|
||||
|
||||
#if GS_WITH_GC == 0
|
||||
static SEL wRelSel;
|
||||
static SEL wRetSel;
|
||||
|
@ -346,24 +348,17 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
case ET_RPORT:
|
||||
{
|
||||
id port = info->receiver;
|
||||
int port_handle_count = 128; // #define this constant
|
||||
int port_handle_array[port_handle_count];
|
||||
if ([port respondsToSelector: @selector(getFds:count:)])
|
||||
{
|
||||
[port getFds: port_handle_array
|
||||
count: &port_handle_count];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"pollUntil - Impossible get win32 Handles");
|
||||
abort();
|
||||
}
|
||||
NSInteger port_handle_count = FDCOUNT;
|
||||
NSInteger port_handle_array[FDCOUNT];
|
||||
|
||||
[port getFds: port_handle_array count: &port_handle_count];
|
||||
NSDebugMLLog(@"NSRunLoop", @"listening to %d port handles",
|
||||
port_handle_count);
|
||||
while (port_handle_count--)
|
||||
{
|
||||
NSMapInsert(handleMap,
|
||||
(void*)(size_t) port_handle_array[port_handle_count], info);
|
||||
(void*)(size_t) port_handle_array[port_handle_count],
|
||||
info);
|
||||
num_handles++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue