Skip to content

Commit

Permalink
dispatch_queue_create second param fix
Browse files Browse the repository at this point in the history
If dispatch_queue_create is used for creating of serial queue, second parameter should be DISPATCH_QUEUE_SERIAL or NULL, but not just 0.
  • Loading branch information
valeriyvan committed Dec 2, 2014
1 parent 6ce4893 commit 3740019
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 2013-07-07-low-level-concurrency-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ One of the basic building blocks of GCD is queues. Below, we'll give a few examp
self = [super init];
if (self != nil) {
NSString *label = [NSString stringWithFormat:@"%@.isolation.%p", [self class], self];
self.isolationQueue = dispatch_queue_create([label UTF8String], 0);
self.isolationQueue = dispatch_queue_create([label UTF8String], NULL);
label = [NSString stringWithFormat:@"%@.work.%p", [self class], self];
self.workQueue = dispatch_queue_create([label UTF8String], 0);
self.workQueue = dispatch_queue_create([label UTF8String], NULL);
}
return self;
}
Expand Down Expand Up @@ -552,7 +552,7 @@ We can't go into all details here, but here's an example for setting up a TCP se

First we create a listening socket and set up an event source for incoming connections:

_isolation = dispatch_queue_create([[self description] UTF8String], 0);
_isolation = dispatch_queue_create([[self description] UTF8String], NULL);
_nativeSocket = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in sin = {};
sin.sin_len = sizeof(sin);
Expand Down Expand Up @@ -586,7 +586,7 @@ When accepting a connection, we create an I/O channel:
}

_remoteAddress = rsa;
_isolation = dispatch_queue_create([[self description] UTF8String], 0);
_isolation = dispatch_queue_create([[self description] UTF8String], NULL);
_channel = dispatch_io_create(DISPATCH_IO_STREAM, native, _isolation, ^(int error) {
NSLog(@"An error occured while listening on socket: %d", error);
});
Expand Down

0 comments on commit 3740019

Please sign in to comment.