update api

master
Daniel Kolesa 2016-08-22 18:44:21 +01:00
parent cdc33aaa8a
commit 1ec5b0febb
1 changed files with 6 additions and 5 deletions

11
main.cc
View File

@ -274,7 +274,6 @@ static ConstCharRange ob_compare_subst(
struct ObState: CsState { struct ObState: CsState {
ConstCharRange progname; ConstCharRange progname;
int jobs = 1;
bool ignore_env = false; bool ignore_env = false;
/* represents a rule definition, possibly with a function */ /* represents a rule definition, possibly with a function */
@ -587,9 +586,9 @@ int main(int argc, char **argv) {
os.init_libs(); os.init_libs();
int jobs = 1;
int ncpus = ostd::Thread::hardware_concurrency(); int ncpus = ostd::Thread::hardware_concurrency();
os.add_ident<cscript::Ivar>("numcpus", 4096, 1, &ncpus); os.add_ident<cscript::Ivar>("numcpus", 4096, 1, ncpus);
os.add_ident<cscript::Ivar>("numjobs", 4096, 1, &os.jobs);
ConstCharRange fcont; ConstCharRange fcont;
ConstCharRange deffile = "obuild.cfg"; ConstCharRange deffile = "obuild.cfg";
@ -622,7 +621,7 @@ int main(int argc, char **argv) {
if (!ival) { if (!ival) {
ival = ncpus; ival = ncpus;
} }
os.jobs = ostd::max(1, ival); jobs = ostd::max(1, ival);
break; break;
} }
default: default:
@ -634,8 +633,10 @@ int main(int argc, char **argv) {
} }
} }
os.add_ident<cscript::Ivar>("numjobs", 4096, 1, jobs);
ThreadPool tpool; ThreadPool tpool;
tpool.init(os.jobs); tpool.init(jobs);
os.register_rulecmds(); os.register_rulecmds();