I have a process intensive script that my friends use of my computer. The
problem is that it eats my cycles and I want to make sure my threads get
priority. I don't see any way to change this in apache. So, I decided to
make a wrapper for php.exe that would spawn it and change the priority.
Anyone have any ideas why apache throws me a Error 500 now. Here is my
program:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
 STARTUPINFO phpSI;
 PROCESS_INFORMATION phpPI;
 BOOL bResult;

 memset(&phpSI, 0, sizeof(STARTUPINFO));
 phpSI.cb = sizeof(STARTUPINFO);
 phpSI.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
 phpSI.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
 phpSI.hStdError = GetStdHandle(STD_ERROR_HANDLE);
 phpSI.dwFlags = STARTF_USESTDHANDLES;  //Use the handles above

 bResult = CreateProcess(
  "php.exe",
  lpCmdLine,
  NULL,
  NULL,
  FALSE,
  IDLE_PRIORITY_CLASS,
  NULL,      // Inherit this process's enviroment
  NULL,
  &phpSI,
  &phpPI);

 if(bResult)
  SetThreadPriority(phpPI.hThread, THREAD_PRIORITY_BELOW_NORMAL); //Set
priority
 return bResult;
}

--
Scott "Wrath" Dial
[EMAIL PROTECTED]
ICQ#3608935
Member of TCPA - tcpa.calc.org
PGP key available



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to