我的计时器耗尽

时间:2015-09-08 11:05:38

标签: c unix timer

if(TIMER_1_EVENT)        sendPeriodicMessage_1_ToProcess_1

if (TIMER_2_EVENT)
   sendPeriodicMessage_2_ToProcess_2

if (TIMER_3_EVENT)
   sendPeriodicMessage_3_ToProcess_3

if (TIMER_4_EVENT)
    sendPeriodicMessage_4_ToProcess_4

if (TIMER_5_EVENT)
    sendPeriodicMessage_5_ToProcess_5

我正在研究这个过程的代码,它基本上发送,接收,转发不同类型的消息到其他进程。现在我有4个定时器,用于发送不同的定期消息。现在需要发送第五种类型的消息。但是这个项目允许的最大计时器数是4(我无法控制,不能将该宏值更改为5)。此外,这五个消息中没有一个共享相同的时间间隔。我该怎么办?你建议我用什么方法来完成这项工作?

sendPeriodicMessage_X_ToProcess_Y     // X & Y be message and process number
{
   Init_Timer();
   ...
   ...
}

void InitTimer()
{
   if (num_Timers >= MaxTimers)    // MaxTimers is 4
       //don't init timer
   else
       // init timer 
}

0 个答案:

没有答案