From e0770de4dbccd3fa22f31deb9765a3b096e534eb Mon Sep 17 00:00:00 2001 From: mguesdon Date: Mon, 24 Nov 2003 10:11:57 +0000 Subject: [PATCH] o added -workerThreadCountMin; o added -setWorkerThreadCountMin: o added -workerThreadCountMax o added -setWorkerThreadCountMax: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18152 72102866-910b-0410-8b05-ffd578937521 --- GSWeb.framework/GSWDefaultAdaptor.h | 7 ++++- GSWeb.framework/GSWDefaultAdaptor.m | 46 +++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/GSWeb.framework/GSWDefaultAdaptor.h b/GSWeb.framework/GSWDefaultAdaptor.h index ce31f7a..18d6179 100644 --- a/GSWeb.framework/GSWDefaultAdaptor.h +++ b/GSWeb.framework/GSWDefaultAdaptor.h @@ -39,6 +39,8 @@ extern int iBlock; int _instance; int _queueSize; int _workerThreadCount; + int _workerThreadCountMin; + int _workerThreadCountMax; BOOL _isMultiThreadEnabled; NSFileHandle* _fileHandle; NSMutableArray* _waitingThreads; @@ -47,7 +49,6 @@ extern int iBlock; BOOL _blocked; } --(void)dealloc; -(id)initWithName:(NSString*)name arguments:(NSDictionary*)arguments; @@ -68,6 +69,10 @@ extern int iBlock; -(void)setWorkerThreadCount:(id)workerThreadCount; -(id)workerThreadCount; +-(void)setWorkerThreadCountMin:(id)workerThreadCount; +-(id)workerThreadCountMin; +-(void)setWorkerThreadCountMax:(id)workerThreadCount; +-(id)workerThreadCountMax; -(void)setListenQueueSize:(id)listenQueueSize; -(BOOL)isMultiThreadEnabled; -(BOOL)isConnectionAllowedWithHandle:(NSFileHandle*)handle diff --git a/GSWeb.framework/GSWDefaultAdaptor.m b/GSWeb.framework/GSWDefaultAdaptor.m index a46a663..4661348 100644 --- a/GSWeb.framework/GSWDefaultAdaptor.m +++ b/GSWeb.framework/GSWDefaultAdaptor.m @@ -71,6 +71,8 @@ int allow_severity = LOG_INFO; // [self setInstance:_instance]; _queueSize=[[arguments objectForKey:GSWOPT_ListenQueueSize[GSWebNamingConv]] intValue]; _workerThreadCount=[[arguments objectForKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]] intValue]; + _workerThreadCountMin=[[arguments objectForKey:GSWOPT_WorkerThreadCountMin[GSWebNamingConv]] intValue]; + _workerThreadCountMax=[[arguments objectForKey:GSWOPT_WorkerThreadCountMax[GSWebNamingConv]] intValue]; _isMultiThreadEnabled=[[arguments objectForKey:GSWOPT_MultiThreadEnabled] boolValue]; ASSIGN(_adaptorHost,[arguments objectForKey:GSWOPT_AdaptorHost[GSWebNamingConv]]); }; @@ -193,15 +195,15 @@ int allow_severity = LOG_INFO; //-------------------------------------------------------------------- --(void)setWorkerThreadCount:(id)workerThreadCount +-(void)setWorkerThreadCountMin:(id)workerThreadCount { if ([self tryLock]) { NS_DURING { - _workerThreadCount=[workerThreadCount intValue]; - if (_workerThreadCount<1) - _workerThreadCount=1; + _workerThreadCountMin=[workerThreadCount intValue]; + if (_workerThreadCountMin<1) + _workerThreadCountMin=1; } NS_HANDLER { @@ -219,9 +221,41 @@ int allow_severity = LOG_INFO; }; //-------------------------------------------------------------------- --(id)workerThreadCount +-(id)workerThreadCountMin { - return [NSNumber numberWithInt:_workerThreadCount]; + return [NSNumber numberWithInt:_workerThreadCountMin]; +}; + +//-------------------------------------------------------------------- +-(void)setWorkerThreadCountMax:(id)workerThreadCount +{ + if ([self tryLock]) + { + NS_DURING + { + _workerThreadCountMax=[workerThreadCount intValue]; + if (_workerThreadCountMax<1) + _workerThreadCountMax=1; + } + NS_HANDLER + { + LOGException(@"%@ (%@)", + localException, + [localException reason]); + } + NS_ENDHANDLER; + [self unlock]; + } + else + { + //TODO + }; +}; + +//-------------------------------------------------------------------- +-(id)workerThreadCountMax +{ + return [NSNumber numberWithInt:_workerThreadCountMax]; }; //--------------------------------------------------------------------