mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-31 00:00:10 +08:00
Check for main thread only during first +initialize call
This commit is contained in:
@@ -244,7 +244,6 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
@synthesize server=_server, address=_address, totalBytesRead=_bytesRead, totalBytesWritten=_bytesWritten;
|
@synthesize server=_server, address=_address, totalBytesRead=_bytesRead, totalBytesWritten=_bytesWritten;
|
||||||
|
|
||||||
+ (void)initialize {
|
+ (void)initialize {
|
||||||
DCHECK([NSThread isMainThread]); // NSDateFormatter should be initialized on main thread
|
|
||||||
if (_separatorData == nil) {
|
if (_separatorData == nil) {
|
||||||
_separatorData = [[NSData alloc] initWithBytes:"\r\n\r\n" length:4];
|
_separatorData = [[NSData alloc] initWithBytes:"\r\n\r\n" length:4];
|
||||||
DCHECK(_separatorData);
|
DCHECK(_separatorData);
|
||||||
@@ -260,6 +259,7 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
DCHECK(_continueData);
|
DCHECK(_continueData);
|
||||||
}
|
}
|
||||||
if (_dateFormatter == nil) {
|
if (_dateFormatter == nil) {
|
||||||
|
DCHECK([NSThread isMainThread]); // NSDateFormatter should be initialized on main thread
|
||||||
_dateFormatter = [[NSDateFormatter alloc] init];
|
_dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
_dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
|
_dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
|
||||||
_dateFormatter.dateFormat = @"EEE',' dd MMM yyyy HH':'mm':'ss 'GMT'";
|
_dateFormatter.dateFormat = @"EEE',' dd MMM yyyy HH':'mm':'ss 'GMT'";
|
||||||
|
|||||||
Reference in New Issue
Block a user