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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 12_sample_system.c

?? Threadx 模版的源代碼
?? C
字號:
/* 12_sample_system.c

   Create two threads, one byte pool, and one message queue.
   The threads communicate with each other via the message queue.
   Arrays are used for the stacks and the queue storage space */


/****************************************************/
/*    Declarations, Definitions, and Prototypes     */
/****************************************************/

#include  "tx_api.h"
#include  <stdio.h>

#define   STACK_SIZE         1024
#define   QUEUE_SIZE         100
#define   QUEUE_MSG_SIZE     TX_1_ULONG
#define   QUEUE_TOTAL_SIZE   QUEUE_SIZE*sizeof(ULONG)*QUEUE_MSG_SIZE

/* Define thread stacks */
CHAR stack_speedy[STACK_SIZE];
CHAR stack_slow[STACK_SIZE];
CHAR queue_storage[QUEUE_TOTAL_SIZE];

/* Define the ThreadX object control blocks */

TX_THREAD  speedy_thread;
TX_THREAD  slow_thread;

TX_TIMER   stats_timer;

TX_QUEUE   my_queue;


/* Define the counters used in the PROJECT application...  */

ULONG  speedy_thread_counter=0, total_speedy_time=0;
ULONG  slow_thread_counter=0, total_slow_time=0;
ULONG  send_message[QUEUE_MSG_SIZE]={0X0}, received_message[QUEUE_MSG_SIZE];



/* Define thread prototypes.  */

void  speedy_thread_entry(ULONG thread_input);
void  slow_thread_entry(ULONG thread_input);
void  print_stats(ULONG);


/****************************************************/
/*               Main Entry Point                   */
/****************************************************/

/* Define main entry point.  */

int main()
{

   /* Enter the ThreadX kernel.  */
   tx_kernel_enter();
}



/****************************************************/
/*             Application Definitions              */
/****************************************************/


/* Define what the initial system looks like.  */

void  tx_application_define(void *first_unused_memory)
{

   /* Put system definition stuff in here, e.g., thread creates
      and other assorted create information.  */

   /* Create the speedy_thread.  */
   tx_thread_create(&speedy_thread, "speedy_thread",
                    speedy_thread_entry, 0,
                    stack_speedy, STACK_SIZE, 5, 5,
                    TX_NO_TIME_SLICE, TX_AUTO_START);

   /* Create the slow thread */
   tx_thread_create(&slow_thread, "slow_thread",
                    slow_thread_entry, 1,
                    stack_slow, STACK_SIZE, 15, 15,
                    TX_NO_TIME_SLICE, TX_AUTO_START);


   /* Create the message queue used by both threads.  */

   tx_queue_create (&my_queue, "my_queue", QUEUE_MSG_SIZE,
                    queue_storage, QUEUE_TOTAL_SIZE);


   /* Create and activate the timer */
   tx_timer_create (&stats_timer, "stats_timer", print_stats,
                    0x1234, 500, 500, TX_AUTO_ACTIVATE);

}


/****************************************************/
/*              Function Definitions                */
/****************************************************/


/* Entry function definition of the "speedy thread"
   it has a higher priority than the "slow thread" */

void  speedy_thread_entry(ULONG thread_input)
{

UINT  status;
ULONG start_time, cycle_time=0, current_time=0;


   /* This is the higher priority "speedy thread" - it sends
      messages to the message queue */
   while(1)
   {

      /* Get the starting time for this cycle */
      start_time = tx_time_get();

      /* Activity 1:  2 ticks.  */
      tx_thread_sleep(2);

      /* Activity 2:  send a message to the queue, then sleep 5 ticks.  */
      send_message[QUEUE_MSG_SIZE-1]++;

      status = tx_queue_send (&my_queue, send_message, TX_WAIT_FOREVER);

      if (status != TX_SUCCESS)  break;  /* Check status */

      tx_thread_sleep(5);

      /* Activity 3:  4 ticks.  */
      tx_thread_sleep(4);

      /* Activity 4: send a message to the queue, then sleep 3 ticks */
      send_message[QUEUE_MSG_SIZE-1]++;

      status = tx_queue_send (&my_queue, send_message, TX_WAIT_FOREVER);

      if (status != TX_SUCCESS)  break;  /* Check status */

      tx_thread_sleep(3);


      /* Increment the thread counter and get timing info  */
      speedy_thread_counter++;

      current_time = tx_time_get();
      cycle_time = current_time - start_time;
      total_speedy_time = total_speedy_time + cycle_time;

   }
}

/************************************************************/

/* Entry function definition of the "slow thread"
   it has a lower priority than the "speedy thread" */

void    slow_thread_entry(ULONG thread_input)
{

UINT    status;
ULONG   start_time, current_time=0, cycle_time=0;


   /* This is the lower priority "slow thread" - it receives messages
      from the message queuue */
   while(1)
   {

      /* Get the starting time for this cycle */
      start_time = tx_time_get();

      /* Activity 5 - receive a message from the queue and sleep 12 ticks.   */
      status = tx_queue_receive (&my_queue, received_message, TX_WAIT_FOREVER);

      if (status != TX_SUCCESS)  break;  /* Check status */

      tx_thread_sleep(12);

      /* Activity 6:  8 ticks.  */
      tx_thread_sleep(8);

      /* Activity 7:  receive a message from the queue and sleep 11 ticks.   */

      /* receive a message from the queue  */
      status = tx_queue_receive (&my_queue, received_message, TX_WAIT_FOREVER);

      if (status != TX_SUCCESS)  break;  /* Check status */

      tx_thread_sleep(11);

      /* Activity 8:  9 ticks.  */
      tx_thread_sleep(9);

      /* Increment the thread counter and get timing info  */
      slow_thread_counter++;

      current_time = tx_time_get();
      cycle_time = current_time - start_time;
      total_slow_time = total_slow_time + cycle_time;

   }
}

/*****************************************************/
/* print statistics at specified times */
void print_stats (ULONG invalue)
{
   ULONG  current_time, avg_slow_time, avg_speedy_time;

   if ((speedy_thread_counter>0) && (slow_thread_counter>0))
   {
      current_time = tx_time_get();
      avg_slow_time = total_slow_time / slow_thread_counter;
      avg_speedy_time = total_speedy_time / speedy_thread_counter;

      printf("\n**** Chapter 12: 2 threads, 1 message queue, and 1 timer.\n\n");
      printf("     Current Time:               %lu\n", current_time);
      printf("         speedy_thread counter:  %lu\n", speedy_thread_counter);
      printf("        speedy_thread avg time:  %lu\n", avg_speedy_time);
      printf("           slow_thread counter:  %lu\n", slow_thread_counter);
      printf("          slow_thread avg time:  %lu\n", avg_slow_time);
      printf("               # messages sent:  %lu\n\n",
             send_message[QUEUE_MSG_SIZE-1]);
   }
   else printf("Bypassing print_stats function, Current Time: %lu\n",
               tx_time_get());
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国v欧美v日本v亚洲v| 亚洲国产成人午夜在线一区| 日韩一卡二卡三卡| 亚洲成人777| 欧美婷婷六月丁香综合色| 国产三级精品在线| 91麻豆免费观看| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲国产欧美在线| 欧美一区二区三区成人| 久久疯狂做爰流白浆xx| 欧美电视剧在线看免费| 高清av一区二区| 国产欧美精品一区二区三区四区 | 亚洲人成小说网站色在线| 国产精品一区在线观看乱码 | 精品人伦一区二区色婷婷| 懂色av一区二区三区免费观看| 成人精品免费网站| 精品动漫一区二区三区在线观看| 成人性生交大合| 亚洲一区二区在线免费看| 国产一区二区视频在线播放| 亚洲女人的天堂| 国产精品青草久久| 欧美精品日韩一本| 在线观看av一区二区| 色诱视频网站一区| 国产在线精品不卡| 捆绑变态av一区二区三区| 国产精品黄色在线观看| 欧美精品1区2区| 99re6这里只有精品视频在线观看| 美女视频免费一区| 美女免费视频一区二区| 欧美激情一区二区三区不卡| 成人sese在线| 美女视频免费一区| 亚洲男同1069视频| 精品国产乱码久久久久久蜜臀 | 亚洲自拍偷拍网站| 久久久久久久久久久黄色| 欧美日韩大陆在线| 99国产欧美久久久精品| 成人avav影音| 亚洲成av人综合在线观看| 日本一区二区三区四区| 日本一区二区三区久久久久久久久不 | 精品99999| 国产视频一区二区在线观看| 欧美一区二区精品在线| 国产精品色哟哟| 日韩一区精品字幕| 91丨porny丨蝌蚪视频| 精品免费国产一区二区三区四区| 亚洲精选在线视频| 国产呦萝稀缺另类资源| 欧美女孩性生活视频| 日本一区二区高清| 日本一区二区视频在线观看| 国产精品对白交换视频| 亚洲精品网站在线观看| 蜜桃视频在线一区| 国产福利一区二区| 色婷婷国产精品| 色哦色哦哦色天天综合| 欧美日韩国产综合久久 | 欧洲精品中文字幕| 久久影院视频免费| 午夜私人影院久久久久| 精品中文字幕一区二区| 成人av手机在线观看| 成人app下载| 欧美在线视频你懂得| 日韩欧美国产系列| 国产亚洲美州欧州综合国| 亚洲伦理在线精品| 日韩av中文字幕一区二区| 国产成人免费视频网站| av男人天堂一区| 7777精品伊人久久久大香线蕉的 | 国产欧美一区二区精品性色超碰 | 亚洲制服丝袜一区| 久久99精品一区二区三区| 不卡视频免费播放| 日韩精品最新网址| 亚洲日本乱码在线观看| 久久99精品久久久久久| 99re免费视频精品全部| 91浏览器打开| 久久久噜噜噜久久人人看| 亚洲一区二区三区小说| 国产福利精品导航| 久久婷婷国产综合精品青草| 亚洲色图视频免费播放| 国产成人av电影在线播放| 日韩一区二区精品在线观看| 夜夜精品视频一区二区| 一本久道久久综合中文字幕| 久久久精品蜜桃| 国产一区视频导航| 久久久久久亚洲综合| 国产成人鲁色资源国产91色综| 国产成人8x视频一区二区| 精品成人私密视频| 激情图片小说一区| 国产亚洲午夜高清国产拍精品| 开心九九激情九九欧美日韩精美视频电影| 欧美性感一类影片在线播放| 亚洲精品免费看| 在线播放日韩导航| 激情综合五月婷婷| 精品久久久久久久久久久久包黑料 | 极品尤物av久久免费看| 日韩精品一区二区三区四区视频| 美女视频免费一区| 国产农村妇女毛片精品久久麻豆| 国产一区二区不卡| 亚洲欧洲综合另类| 91精品国产色综合久久久蜜香臀| 强制捆绑调教一区二区| 国产欧美日韩亚州综合| 色婷婷激情一区二区三区| 免费观看成人鲁鲁鲁鲁鲁视频| www国产成人| 欧美日韩视频在线第一区| 日韩电影在线看| 一区二区三区欧美在线观看| 69久久夜色精品国产69蝌蚪网| 激情综合网av| 日韩电影一区二区三区| 中文字幕日韩av资源站| 日韩欧美综合一区| 91国产成人在线| 国产高清无密码一区二区三区| 亚洲一区二区三区四区在线观看| 日韩精品一区在线观看| 欧美专区在线观看一区| 国产91色综合久久免费分享| 亚洲国产成人午夜在线一区| 91久久线看在观草草青青| 一区二区理论电影在线观看| 精品国产伦理网| 666欧美在线视频| 欧美日韩电影一区| 欧美三级日本三级少妇99| av资源站一区| 成人中文字幕电影| 粉嫩13p一区二区三区| 国产精一品亚洲二区在线视频| 五月激情综合婷婷| 午夜精品成人在线| 视频一区中文字幕| 五月激情丁香一区二区三区| 自拍偷自拍亚洲精品播放| 国产精品高清亚洲| 自拍av一区二区三区| 亚洲精品成人a在线观看| 亚洲最大的成人av| 日本午夜精品视频在线观看| 日韩不卡一二三区| 老鸭窝一区二区久久精品| 久久精品国产色蜜蜜麻豆| 国产在线观看一区二区| 不卡在线观看av| 欧美性大战久久久久久久蜜臀 | 国产精品一区二区三区网站| 另类小说图片综合网| 国产成人福利片| 欧美午夜精品久久久久久孕妇| 欧美日韩视频在线观看一区二区三区| 91精品在线一区二区| 久久久高清一区二区三区| 一区二区三区欧美日| 另类小说视频一区二区| 91美女视频网站| 26uuu另类欧美| 亚洲综合清纯丝袜自拍| 久久精品久久99精品久久| 不卡欧美aaaaa| 精品日本一线二线三线不卡| 亚洲欧洲日产国产综合网| 日韩电影一区二区三区| 91在线播放网址| 2021久久国产精品不只是精品| 中文字幕色av一区二区三区| 日本成人超碰在线观看| 成人av电影在线网| 精品国产乱码久久久久久免费| 亚洲欧美日韩国产综合在线| 国产精品夜夜嗨| 精品少妇一区二区| 精品在线一区二区| 4438x成人网最大色成网站| 一区二区三区日韩精品| 一本大道久久a久久精品综合| 久久久久久久久久久99999| 亚洲最色的网站| 91免费观看视频| 中文字幕在线播放不卡一区|