Added environmen variable into the stratagus launcer to reduce CPU load while already finished threads are wating for still working yet ones.

This commit is contained in:
alyokhin 2021-04-29 12:41:57 +03:00
parent 34ae082a84
commit dbf039097e

View file

@ -661,13 +661,16 @@ int main(int argc, char * argv[]) {
}
stratagus_argv[argc + 2] = NULL;
// Needed to reduce CPU load while idle threads are wating for havn't finished yet ones
char *const env[] = { (char*)"OMP_WAIT_POLICY=passive", NULL };
#ifdef WIN32
int ret = _spawnvp(_P_WAIT, stratagus_bin, stratagus_argv);
int ret = _spawnvpe(_P_WAIT, stratagus_bin, stratagus_argv, env);
#else
int ret = 0;
int childpid = fork();
if (childpid == 0) {
execvp(stratagus_bin, stratagus_argv);
execvpe(stratagus_bin, stratagus_argv, env);
if (strcmp(stratagus_bin, "stratagus") == 0) {
realpath(argv[0], stratagus_bin);
parentdir(stratagus_bin);