Operation queue convenience methods

This commit is contained in:
rfm 2025-01-07 13:05:55 +00:00
parent 6b04eaa35c
commit 4c9c691626
4 changed files with 121 additions and 3 deletions

View file

@ -22,9 +22,12 @@
*/
#import "../common.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSException.h"
#import "Foundation/NSMapTable.h"
#import "Foundation/NSObject.h"
#import "Foundation/NSOperation.h"
#import "GNUstepBase/GSObjCRuntime.h"
#import "GNUstepBase/NSOperationQueue+GNUstepBase.h"
@ -72,6 +75,23 @@
*/
@implementation NSOperationQueue (GNUstepBase)
- (void) addOperationWithTarget: (id<NSObject>)aTarget
performSelector: (SEL)aSelector
withMap: (id)firstKey, ...
{
GSTargetOperation *top;
NSDictionary *map;
map = [NSDictionary alloc];
GS_USEIDPAIRLIST(firstKey,
map = [map initWithObjects: __pairs forKeys: __objects count: __count/2]);
top = [GSTargetOperation operationWithTarget: aTarget
performSelector: aSelector
withObject: AUTORELEASE(map)];
[self addOperation: top];
}
- (void) addOperationWithTarget: (id<NSObject>)aTarget
performSelector: (SEL)aSelector
withObject: (id<NSObject>)object1