Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.2 KiB

  1. Include('types.js');
  2. Include('utils.js');
  3. var g_fMsg = false;
  4. function threadstest_js::ScriptMain()
  5. {
  6. var nEvent;
  7. var nCount = 0;
  8. var strWait = ScriptParam.split(',')[0];
  9. var strID = ScriptParam.split(',')[1];
  10. JSignalThreadSync('threadstestThreadReady');
  11. do
  12. {
  13. nEvent = JWaitForMultipleSyncs('threadstestThreadExit,' + strWait, 0, 0);
  14. if (nEvent == 2)
  15. {
  16. LogMsg("threadtest " + strID + " starting");
  17. PrivateData.objUtil.fnStress(strID);
  18. }
  19. }
  20. while(nEvent != 1);
  21. LogMsg("threadstest exiting.");
  22. }
  23. function JSignalThreadSync(strSigs)
  24. {
  25. if (g_fMsg)
  26. LogMsg("SIGNALLING " + strSigs);
  27. SignalThreadSync(strSigs);
  28. }
  29. function JWaitForMultipleSyncs(strSigs, fWaitAll, nTimeOut)
  30. {
  31. if (g_fMsg)
  32. LogMsg("WAITING " + strSigs);
  33. var nEvent = WaitForMultipleSyncs(strSigs, fWaitAll, nTimeOut);
  34. if (g_fMsg)
  35. {
  36. if (nEvent == 0)
  37. LogMsg("TIMEOUT");
  38. else
  39. LogMsg("RECEIVED " + strSigs.split(',')[nEvent - 1]);
  40. }
  41. return nEvent;
  42. }
  43. function JWaitForSync(strSigs, nTimeOut)
  44. {
  45. if (g_fMsg)
  46. return JWaitForMultipleSyncs(strSigs, false, nTimeOut);
  47. return WaitForSync(strSigs, nTimeOut);
  48. }