--- libaitio/src/exec.c 2013/12/05 15:56:10 1.1.2.7 +++ libaitio/src/exec.c 2013/12/05 16:57:08 1.1.2.8 @@ -116,7 +116,7 @@ io_progOpen(prog_t * __restrict prg, u_int execNum) if (!prg) return 0; - if (execNum > prg->prog_maxn) { + if (prg->prog_cnum + execNum > prg->prog_maxn) { io_SetErr(EINVAL, "Requested number for program execution is over pool's limit"); return 0; } @@ -142,6 +142,28 @@ io_progOpen(prog_t * __restrict prg, u_int execNum) pthread_mutex_unlock(&prg->prog_mtx); return ret; +} + +/* + * io_progGrow() - Execute to number of programs in pool + * + * @prg = program pool + * @toNum = execute to number of programs (0 max) + * return: 0 error, >0 executed programs and abs(<0) executed programs with logged error + */ +int +io_progGrow(prog_t * __restrict prg, u_int toNum) +{ + if (!prg) + return 0; + if (toNum > prg->prog_maxn) { + io_SetErr(EINVAL, "Requested number for program execution is over pool's limit"); + return 0; + } + if (!toNum) + toNum = prg->prog_maxn; + + return io_progOpen(prg, toNum - prg->prog_cnum); } /*