const parameter + intermediate reused variable
This commit is contained in:
parent
13cf3dbc14
commit
9e93f52481
1 changed files with 5 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ template< class EOT >
|
|||
class eoEvalUserTimeThrowException : public eoEvalFuncCounter< EOT >
|
||||
{
|
||||
public:
|
||||
eoEvalUserTimeThrowException( eoEvalFunc<EOT> & func, long max ) : _max(max), eoEvalFuncCounter<EOT>( func, "CPU-user") {}
|
||||
eoEvalUserTimeThrowException( eoEvalFunc<EOT> & func, const long max ) : _max(max), eoEvalFuncCounter<EOT>( func, "CPU-user") {}
|
||||
|
||||
virtual void operator() ( EOT & eo )
|
||||
{
|
||||
|
|
@ -47,8 +47,9 @@ public:
|
|||
|
||||
getrusage(RUSAGE_SELF,&_usage);
|
||||
|
||||
if( _usage.ru_utime.tv_sec >= _max ) {
|
||||
throw eoMaxTimeException( _usage.ru_utime.tv_sec );
|
||||
long current = _usage.ru_utime.tv_sec;
|
||||
if( current >= _max ) {
|
||||
throw eoMaxTimeException( current );
|
||||
} else {
|
||||
func(eo);
|
||||
}
|
||||
|
|
@ -56,6 +57,6 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
long _max;
|
||||
const long _max;
|
||||
struct rusage _usage;
|
||||
};
|
||||
|
|
|
|||
Reference in a new issue