亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tskttsk.c

?? 一個多任務(wù)操作系統(tǒng)CTask的源代碼 用C語言編寫
?? C
字號:
/*
   --- Version 2.2 90-11-19 17:59 ---

   TSKTTSK.C - CTask - Timer task.

   CTask - a Multitasking Kernel for C

   Public Domain Software written by
      Thomas Wagner
      Ferrari electronic Gmbh
      Beusselstrasse 27
      D-1000 Berlin 21
      Germany

   No rights reserved.

   This file is new with 2.1. The timer task functions were moved
   from tsktimer to this module.

   Timer logic has been significantly changed in version 2.0.
*/

#include "tsk.h"
#include "tsklocal.h"

/*
   tsk_timer_action 
      performs the necessary action when a timeout occurred.
      Starting with version 2.0, this part is not critical,
      and may be preempted.

      Version 2.1 makes this routine global for use by the keyboard
      hotkey handler.
*/

void Localfunc tsk_timer_action (tlinkptr elem)
{
   tcbptr task;
   byte st;
   CRITICAL;

   switch (elem->struckind)
      {
      case TKIND_WAKE:
      case TKIND_TASK:  task = (tcbptr) elem->strucp;
                        C_ENTER;
                        st = task->state;

                        if (st == ST_WAITING || st == ST_DELAYED)
                           {
                           task->retptr = 
                              (elem->link.kind == TYP_TIMER)
                                 ? TTIMEOUT
                                 : TWATCH;
                           tsk_runable (task);
                           }
                        C_LEAVE;
                        break;

      case TKIND_FLAG:  set_flag ((flagptr) elem->strucp);
                        break;

      case TKIND_COUNTER: inc_counter ((counterptr) elem->strucp);
                        break;

      case TKIND_COUNTDEC: dec_counter ((counterptr) elem->strucp);
                        break;

      case TKIND_PROC:  tsk_callfunc (elem->strucp, elem);
                        break;

      default:          break;
      }
}


/*
   tsk_exec_watch 
      checks the watch condition, and returns 1 if the 
      condition is met.
*/

local int Staticfunc tsk_exec_watch (tlinkptr curr)
{
   word val, cmp;
   int elcmp;

   elcmp = curr->elkind & 0x0f;

   switch (curr->elkind & 0xf0)
      {
      case TELEM_MEM:   val = *(curr->elem.mem.address) & curr->elem.mem.mask;
                        cmp = curr->elem.mem.compare;
                        if (elcmp == TCMP_CHG)
                           curr->elem.mem.compare = val;
                        break;

      /* Microsoft C generates "Internal Compiler Error" on compiling
         the following statement */
#if (TSK_TURBO)
      case TELEM_PORT:  val = (curr->elem.port.in_word)
                              ? tsk_inpw (curr->elem.port.port)
                              : (word)tsk_inp (curr->elem.port.port);
#else
      case TELEM_PORT:  if (curr->elem.port.in_word)
                           val = tsk_inpw (curr->elem.port.port);
                        else
                           val = (word)tsk_inp (curr->elem.port.port);
#endif
                        val &= curr->elem.port.mask;
                        cmp = curr->elem.port.compare;
                        if (elcmp == TCMP_CHG)
                           curr->elem.port.compare = val;
                        break;

      default:          return 0;
      }

   switch (elcmp)
      {
      case TCMP_EQ:  return val == cmp;
      case TCMP_CHG:
      case TCMP_NE:  return val != cmp;
      case TCMP_LE:  return val <= cmp;
      case TCMP_GE:  return val >= cmp;
      case TCMP_LES: return (int)val <= (int)cmp;
      case TCMP_GES: return (int)val >= (int)cmp;
      default:       return 0;
      }
}


/*
   The timer task handles all timeouts.

   Starting with version 2.0, two queues are maintained, one for
   the timeouts, and one for watch elements.

   The timeout queue now is ordered, with the tick count in the queue
   element head holding the difference in ticks to the previous element.
   Thus, only the first element of the timeout queue has to be counted
   down, which will considerably speed up processing here if there are
   multiple elements in the queue.

   The watch queue is unordered.

   The loop to check the queue elements is fully protected.
   This allows other tasks access to the timer queue. The
   concept used in pre-2.0 versions was pretty complicated to
   handle, and still had to run with interupts disabled for
   most parts.

   The new logic unchains expired timeout elements immediately, within
   the protected loop, but delays processing them until after the loop 
   is finished. Modification of those elements should not normally occur,
   and will be rejected. The processing of the timeout/watch action can 
   thus be handled with interrupts enabled.

   Version 2.1 corrects a bug that prevented wakeup elements from being
   correctly processed if they had the repeat attribute. It introduces
   a single link pointer in the timer control block for chaining the
   elements to be acted upon, which is used exclusively by the timer
   task. The 2.0 algorithm used the normal timer queue for chaining,
   which convoluted the code, and, in the end, led to the mentioned bug.

   Version 2.2 cleans up processing by eliminating the "state" field,
   all necessary info is now contained in the flags. This better supports
   enabling and disabling elements while the timer task is processing them.
*/

void Taskfunc tsk_timer (void)
{
   queptr curr;
   queptr help;
   tlinkptr tlast;
   tlinkptr tcurr;
   byte flg;
   CRITICAL;

   while (1)
      {
      wait_counter_set (&tsk_timer_counter, 0L);

      tlast = LNULL;

      C_ENTER;

      /* First, check the timeout queue. Since version 2.0, only
         the first element has to be counted down.
      */

      if (!((curr = GLOBDATA timer_queue.first)->kind & Q_HEAD))
         if (!--curr->el.ticks)
            {
            /* Remove all counted-down elements from the timer queue,
               marking them as not in queue and busy, and chaining them
               through the special "next" pointer.
               We can then process the elements outside the critical 
               section.
            */
            do
               {
               help = curr;
               curr = curr->next;
               tsk_dequeue (help);
               ((tlinkptr)help)->flags |= TFLAG_BUSY;
               ((tlinkptr)help)->next = tlast;
               tlast = (tlinkptr)help;
               }
            while (!(curr->kind & Q_HEAD) && !curr->el.ticks);
            }

      C_LEAVE;
      /* shortly allow interrupts */
      C_ENTER;

      /* Now, check the watch queue. */

      for (curr = GLOBDATA watch_queue.first; !(curr->kind & Q_HEAD); )
         {
         help = curr;
         curr = curr->next;

         if (tsk_exec_watch ((tlinkptr)help))
            {
            tsk_dequeue (help);
            ((tlinkptr)help)->flags |= TFLAG_BUSY;
            ((tlinkptr)help)->next = tlast;
            tlast = (tlinkptr)help;
            }
         }

      /* Ready checking the queues, we can now re-enable interrupts
         for execution of the timeout/watch action. Interrupts are
         disabled only for a short period to check the state and
         re-enqueue repeat elements.  */

      C_LEAVE;

      while (tlast != LNULL)
         {
         tcurr = tlast;
         tlast = tlast->next;
         tsk_timer_action (tcurr);

         C_ENTER;
         flg = tcurr->flags;
         if (flg & TFLAG_REMOVE)
            {
            if (!(flg & TFLAG_TEMP))
               flg &= ~TFLAG_REMOVE;
            }
         else if (!(flg & TFLAG_UNQUEUE))
            {
            if (flg & (TFLAG_REPEAT | TFLAG_ENQUEUE))
               {
               if (tcurr->link.kind == TYP_TIMER)
                  tsk_enqtimer ((queptr)tcurr, tcurr->elem.time.reload);
               else
                  tsk_putqueue (&GLOBDATA watch_queue, (queptr)tcurr);
               }
            }
         tcurr->flags &= ~(TFLAG_BUSY | TFLAG_UNQUEUE | TFLAG_ENQUEUE | TFLAG_REMOVE);
         C_LEAVE;

#if (TSK_DYNAMIC)
         if (flg & TFLAG_REMOVE)
            {
#if (GROUPS)
            tsk_dequeue ((queptr)&tcurr->chain);
#endif
            tsk_pfree (tcurr);
            }
#endif
         }
      }
}


/*
   int8 is the timer interrupt chain task.
*/

#if (IBM && !INT8_EARLY)

void Taskfunc tsk_int8 (void)
{
   while (1)
      {
      wait_counter_set (&tsk_int8_counter, 0L);
      tsk_chain_timer ();
      }
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久国产精品潘金| 91精品在线麻豆| 欧美精品777| 久久久久久夜精品精品免费| 亚洲成年人影院| 国产成人免费网站| 在线播放亚洲一区| 国产精品护士白丝一区av| 美脚の诱脚舐め脚责91| 色呦呦一区二区三区| 亚洲国产精品高清| 久久99精品一区二区三区| 欧美人体做爰大胆视频| 亚洲欧洲精品一区二区三区| 国内成人自拍视频| 91精品国产日韩91久久久久久| 亚洲欧洲无码一区二区三区| 国精品**一区二区三区在线蜜桃| 欧美精品久久天天躁| 亚洲免费观看高清完整版在线观看| 国产最新精品精品你懂的| 日韩一级完整毛片| 亚洲成人综合视频| 在线一区二区三区四区五区| 国产精品国模大尺度视频| 国产美女精品人人做人人爽| 欧美成人高清电影在线| 日本欧美久久久久免费播放网| 欧美三级视频在线播放| 一区二区在线观看免费 | 日日欢夜夜爽一区| 色妞www精品视频| 亚洲天堂a在线| av在线一区二区三区| 国产片一区二区| 国产乱理伦片在线观看夜一区| 精品国产一区二区三区不卡| 久久成人av少妇免费| 精品国产麻豆免费人成网站| 久久国产精品区| 久久青草欧美一区二区三区| 高清日韩电视剧大全免费| 欧美激情综合五月色丁香 | 国产日韩欧美麻豆| 国产精品一区免费视频| 欧美极品少妇xxxxⅹ高跟鞋| 一本一道久久a久久精品综合蜜臀| 亚洲视频每日更新| 欧美日韩二区三区| 日韩电影在线免费观看| 精品久久久久久无| 国产精品888| 最新欧美精品一区二区三区| 在线亚洲一区观看| 日韩电影在线免费看| 久久看人人爽人人| 色综合久久中文字幕| 午夜精品久久久久久久久 | 欧美三级午夜理伦三级中视频| 性感美女极品91精品| 日韩欧美国产精品| 丰满白嫩尤物一区二区| 综合自拍亚洲综合图不卡区| 欧美亚洲国产一区在线观看网站| 人人精品人人爱| 亚洲国产精品高清| 欧美精品自拍偷拍| 国产传媒久久文化传媒| 亚洲精品va在线观看| 日韩美一区二区三区| 成人久久久精品乱码一区二区三区| 国产精品久久久久久久久免费丝袜| 91社区在线播放| 美女视频一区二区| 自拍偷自拍亚洲精品播放| 欧美日韩不卡一区| 岛国av在线一区| 日韩av电影天堂| 18涩涩午夜精品.www| 91精品国产综合久久久蜜臀粉嫩 | 免费在线观看一区二区三区| 中文字幕成人av| 在线91免费看| 色综合天天视频在线观看| 激情综合色播激情啊| 亚洲国产一区二区视频| 久久久99精品久久| 在线综合视频播放| 91在线视频免费观看| 国产美女精品在线| 日韩av在线播放中文字幕| 亚洲美女区一区| 久久婷婷成人综合色| 欧美久久久久久久久中文字幕| 99久久伊人精品| 成人免费av资源| 激情久久五月天| 青青草国产精品亚洲专区无| 亚洲最色的网站| 国产精品久久久久永久免费观看| 久久综合999| 精品免费国产一区二区三区四区| 欧美日韩免费在线视频| 色成人在线视频| 99久久er热在这里只有精品15 | 亚洲第一精品在线| 日韩理论在线观看| 国产日本一区二区| 久久精品一区二区| 久久久久九九视频| 26uuu亚洲| 精品国产91亚洲一区二区三区婷婷 | 日本91福利区| 日韩中文字幕av电影| 亚洲bt欧美bt精品| 亚洲五月六月丁香激情| 亚洲国产日韩一级| 亚洲一区二区视频在线| 亚洲综合视频网| 亚洲国产一二三| 午夜精品成人在线视频| 亚洲一区二区三区爽爽爽爽爽| 亚洲一区二区三区四区五区黄| 亚洲一区二区欧美激情| 亚洲成在人线在线播放| 香蕉加勒比综合久久| 轻轻草成人在线| 国产一区二区三区四 | 日韩成人一级片| 蜜臀av性久久久久蜜臀aⅴ流畅| 婷婷六月综合亚洲| 日本伊人色综合网| 国产一区二区三区免费| 国产·精品毛片| 色综合色综合色综合色综合色综合 | 99久久免费视频.com| 丁香亚洲综合激情啪啪综合| 成人av资源在线| 欧美中文字幕一二三区视频| 欧美日本高清视频在线观看| ww亚洲ww在线观看国产| 中文幕一区二区三区久久蜜桃| 成人欧美一区二区三区视频网页| 一区二区三区不卡在线观看| 日韩综合小视频| 国产一区二区三区黄视频| 成人高清免费在线播放| 日本高清不卡aⅴ免费网站| 欧美三级乱人伦电影| 欧美精品一区二区在线播放| 中文字幕日韩av资源站| 香蕉成人伊视频在线观看| 精品亚洲成a人| 在线观看不卡一区| 久久亚洲精精品中文字幕早川悠里 | 粉嫩久久99精品久久久久久夜| 97se狠狠狠综合亚洲狠狠| 欧美日韩美少妇| 日本一区二区三区高清不卡| 亚洲一二三四在线| 国产成人精品免费一区二区| 欧美在线999| 国产亚洲一区字幕| 亚洲国产另类精品专区| 国产精品18久久久久久久久| 在线观看av一区| 国产婷婷色一区二区三区| 亚洲国产视频网站| 国产宾馆实践打屁股91| 欧美精品久久一区二区三区| 亚洲欧洲av一区二区三区久久| 免费三级欧美电影| 一本色道久久综合亚洲精品按摩| 精品国产乱码久久| 日韩电影在线免费观看| 色婷婷综合久久久久中文| 久久久久国产免费免费| 日本三级亚洲精品| 欧洲av一区二区嗯嗯嗯啊| 中文子幕无线码一区tr| 奇米777欧美一区二区| 91久久一区二区| 国产精品久久午夜夜伦鲁鲁| 国产一区二区在线免费观看| 欧美一区二区视频在线观看| 亚洲精品视频在线观看网站| 国产.欧美.日韩| 欧美精品一区二区三区视频| 青青草国产成人99久久| 欧美日韩一级二级| 亚洲精品中文在线观看| thepron国产精品| 亚洲国产高清在线| 国产精品一区二区果冻传媒| 久久亚洲私人国产精品va媚药| 久久精品国产**网站演员| 91精品国产手机| 男人的j进女人的j一区| 欧美一级理论片| 蜜臂av日日欢夜夜爽一区|