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
This commit is contained in:
Manuel Guesdon 2003-11-24 10:11:57 +00:00
parent 5b1d56dc5e
commit 209ca67efc
2 changed files with 46 additions and 7 deletions

View file

@ -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

View file

@ -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];
};
//--------------------------------------------------------------------