示例#1
0
文件: phase2.c 项目: awewing/usloss
static void clockHandler2(int dev, void *arg) {
    long unit = (long) arg;
    int clockResult;

    // check if dispatcher should be called
    if (readCurStartTime() >= 80000) {
        timeSlice();
    }

    // inc that a clock interrupt happened
    clockTicks++;

    USLOSS_DeviceInput(dev, unit, &clockResult);

    
    // every fith interrupt do a conditional send to its mailbox
    if (clockTicks % 5 == 0) {

        if (debugflag2 && DEBUG2) {
            USLOSS_Console("clockHandler2: sending message %s to mbox %d\n", clockResult, clockBox.mboxID);
        }

        int sendResult = MboxCondSend(clockBox.mboxID, &clockResult, sizeof(clockResult));

        if (debugflag2 && DEBUG2) {
            USLOSS_Console("clockHandler2: send returned %d\n", sendResult);
            USLOSS_Halt(1);
        }
    }
}
示例#2
0
void clockHandler2(int dev, void* unit)
{
  if (DEBUG2 && debugflag2)
      USLOSS_Console("clockHandler2(): called\n");
  static int i = 1;
  if (i++ > 4){
    i = 0;
    MboxCondSend(0, 0, 0);
  }
  timeSlice();

} /* clockHandler */