mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
DO patches (Sep 12 from Richard Frith-MacDonald)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2419 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
499701e1c1
commit
aa0e1c2375
11 changed files with 168 additions and 59 deletions
|
@ -830,6 +830,60 @@ static int debug_run_loop = 0;
|
|||
return when;
|
||||
}
|
||||
|
||||
- (RunLoopWatcher*) _getWatcher: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSArray *watchers;
|
||||
RunLoopWatcher *info;
|
||||
int count;
|
||||
|
||||
if (mode == nil)
|
||||
mode = _current_mode;
|
||||
|
||||
watchers = NSMapGet (_mode_2_watchers, mode);
|
||||
if (watchers == nil) {
|
||||
return nil;
|
||||
}
|
||||
for (count = 0; count < [watchers count]; count++) {
|
||||
info = [watchers objectAtIndex: count];
|
||||
|
||||
if ([info getType] == type) {
|
||||
if ([info getData] == data) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) _removeWatcher: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSMutableArray *watchers;
|
||||
|
||||
if (mode == nil )
|
||||
mode = _current_mode;
|
||||
|
||||
watchers = NSMapGet (_mode_2_watchers, mode);
|
||||
if (watchers) {
|
||||
int i;
|
||||
|
||||
for (i = [watchers count]; i > 0; i--) {
|
||||
RunLoopWatcher* info;
|
||||
|
||||
info = (RunLoopWatcher*)[watchers objectAtIndex:(i-1)];
|
||||
if ([info getType] == type && [info getData] == data) {
|
||||
[info invalidate];
|
||||
[watchers removeObject: info];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Listen to input sources.
|
||||
If LIMIT_DATE is nil, then don't wait; i.e. call select() with 0 timeout */
|
||||
|
@ -909,59 +963,6 @@ static int debug_run_loop = 0;
|
|||
wfd_2_object = NSCreateMapTable (NSIntMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 0);
|
||||
|
||||
- (RunLoopWatcher*) _getWatcher: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSArray *watchers;
|
||||
RunLoopWatcher *info;
|
||||
int count;
|
||||
|
||||
if (mode == nil)
|
||||
mode = _current_mode;
|
||||
|
||||
watchers = NSMapGet (_mode_2_watchers, mode);
|
||||
if (watchers == nil) {
|
||||
return nil;
|
||||
}
|
||||
for (count = 0; count < [watchers count]; count++) {
|
||||
info = [watchers objectAtIndex: count];
|
||||
|
||||
if ([info getType] == type) {
|
||||
if ([info getData] == data) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) _removeWatcher: (void*)data
|
||||
type: (RunLoopEventType)type
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
NSMutableArray *watchers;
|
||||
|
||||
if (mode == nil )
|
||||
mode = _current_mode;
|
||||
|
||||
watchers = NSMapGet (_mode_2_watchers, mode);
|
||||
if (watchers) {
|
||||
int i;
|
||||
|
||||
for (i = [watchers count]; i > 0; i--) {
|
||||
RunLoopWatcher* info;
|
||||
|
||||
info = (RunLoopWatcher*)[watchers objectAtIndex:(i-1)];
|
||||
if ([info getType] == type && [info getData] == data) {
|
||||
[info invalidate];
|
||||
[watchers removeObject: info];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do the pre-listening set-up for the file descriptors of this mode. */
|
||||
{
|
||||
NSArray *watchers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue