/*------------------------------------------------------------------------ * handleCallback - LAB 4Q2 LAB 4Q3 this method handles the invocation of callback functions for MYSIGALRM and * MYSIGRECV signals, MYSIGXCPU is take care of in the clkhandler.c . If the conditions * are met then the corresponding callback function is invoked right after being context * switched in . *------------------------------------------------------------------------ */ void handleCallback() { struct procent *ptcurr; ptcurr = &proctab[currpid]; // MYSIGRECV related callback processing if(ptcurr->callback != NULL) { if(ptcurr->prhasmsg == TRUE){ // ensure that a message has arrived void (*callbackfn) () = ptcurr->callback; callbackfn(); ptcurr->prhasmsg = FALSE; // RESET the message buffer flag } } // MYSIGALARM related callback processing if (ptcurr->alarmfunc!= NULL) { if(ptcurr->alarmTimeOut) { ptcurr->alarmTimeOut = FALSE; ptcurr->alarmtime = 0; void (*alarmFunction) () = ptcurr->alarmfunc; alarmFunction(); ptcurr->alarmfunc = NULL; } } }
/** * Allows other active objects to run while waiting for the specified time. * */ void CTestStepCsdAgt::DelayL(TInt aMicroseconds) { // Construct and start the timer TCallBack callbackfn(CTestStepCsdAgt::TimerCallback, this); CPeriodic *regularUpdater = CPeriodic::NewL(CActive::EPriorityStandard); CleanupStack::PushL(regularUpdater); regularUpdater->Start(aMicroseconds,aMicroseconds,callbackfn); // Block until timer complete CActiveScheduler::Start(); // Stop and delete the timer regularUpdater->Cancel(); CleanupStack::PopAndDestroy(); }