Permalink
Browse files

Added sharedNetworkQueue, a singleton-like queue that will save you h…

…aving to manage queues yourself
  • Loading branch information...
1 parent 32e18c0 commit 23f06a5d5dfedf6babc32c3e744e9015494a0044 @pokeb committed Mar 22, 2009
Showing with 12 additions and 0 deletions.
  1. +3 −0 Classes/ASINetworkQueue.h
  2. +9 −0 Classes/ASINetworkQueue.m
@@ -83,6 +83,9 @@
// This method will start the queue
- (void)go;
+// A globally available network queue, created the first time it is requested
++ (ASINetworkQueue *)sharedNetworkQueue;
+
@property (assign,setter=setUploadProgressDelegate:) id uploadProgressDelegate;
@property (assign,setter=setDownloadProgressDelegate:) id downloadProgressDelegate;
@@ -9,6 +9,7 @@
#import "ASINetworkQueue.h"
#import "ASIHTTPRequest.h"
+static ASINetworkQueue *sharedNetworkQueue = nil;
@implementation ASINetworkQueue
@@ -288,6 +289,14 @@ - (BOOL)respondsToSelector:(SEL)selector
}
++ (ASINetworkQueue *)sharedNetworkQueue
+{
+ if (!sharedNetworkQueue) {
+ sharedNetworkQueue = [[ASINetworkQueue alloc] init];
+ }
+ return sharedNetworkQueue;
+}
+
@synthesize uploadProgressDelegate;
@synthesize downloadProgressDelegate;

0 comments on commit 23f06a5

Please sign in to comment.