multithreading - C++ multi threaded scheduling application issues -


background

i maintaining windows mfc c++ multi threaded job scheduling application. users schedule tasks run local computer. inactive users automatically transfer tasks active users.

issues

some jobs failing run. same jobs, not same jobs. there 2 jobs fail. have varying expected run times. both scheduled run on non-overlapping time intervals 1 another.

method creating processes:

the location of job fed following function:

 int virtualgriddriver::runapplicationasprocesswithexitcode(cstring cmdline)  {     process_information processinformation = {0};     startupinfo startupinfo                = {0};     startupinfo.cb                         = sizeof(startupinfo);     int nstrbuffer                         = cmdline.getlength() + 50;      //create process     bool result = createprocess(null, cmdline.getbuffer(nstrbuffer),                                  null, null, false,                                  normal_priority_class | create_no_window,                                  null, null, &startupinfo, &processinformation);     cmdline.releasebuffer();       if (!result)     {       //createprocess() failed       //get error system        lpvoid lpmsgbuf;        dword dw = getlasterror();        formatmessage(format_message_allocate_buffer | format_message_from_system | format_message_ignore_inserts,                       null, dw, makelangid(lang_neutral, sublang_default), (lptstr) &lpmsgbuf, 0, null);        //display error        cstring strerror = (lptstr) lpmsgbuf;        //free resources created system        localfree(lpmsgbuf);        //we failed.        return 1;     }     else     {       //successfully created process.  wait finish.        waitforsingleobject( processinformation.hprocess, infinite );        dword b;        getexitcodeprocess (processinformation.hprocess, &b);        //close handles.        closehandle( processinformation.hprocess );        closehandle( processinformation.hthread );         int ret = int(b);        //we succeeded.        return ret;     }  } 

the failed jobs return exit code 1. can identify possible issues? if not, can provide issues may consider looking more into? multithreaded issue?


Comments

Popular posts from this blog

Redirect to a HTTPS version using .htaccess -

Unlimited choices in BASH case statement -

javascript - jQuery: Add class depending on URL in the best way -