When I use _beginthread(), it doesn't run the thread everytime. Is there a way to be sure the call to another thread will run?
Thanks,
Matt
Code:
...
else if((!bRewarded) && (bICTA) && (bInRef)) {
ldHotClk = ldStateCtr - ldHotRef;
if(ldHotClk > iTime) {
bRewarded = true;
++iRewardNum;
bICTA = false;
ldColdClk = 0;
ldHoldColdClk = 0;
ldHoldEndColdClk = 0;
bOutRef = false;
_beginthread(SignalPlacePref, 0, NULL);
}
...
/*****************************************************/
void SignalPlacePref(void)
{
bThreadFunctCalled = true;
if(!bRewardiscontinue) {
cbDBitOut(iBoardNum, iPortType, iBitNum1, 1); // Raise digital bit 1 to set Enable Hi
Sleep(5); // Wait to besure Enable is Hi before next step
cbDBitOut(iBoardNum, iPortType, iBitNum0, 1); // Raise digital bit 0 to trigger plt fdr
Sleep(10); // Ensure long pulse for triggering plt fdr
cbDBitOut(iBoardNum, iPortType, iBitNum0, 0); // Bring bits down
cbDBitOut(iBoardNum, iPortType, iBitNum1, 0);
}
_endthread();
}
/*******************************************************/