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

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

?? rt_ipc.c

?? fsmlabs的real time linux的內核
?? C
?? 第 1 頁 / 共 3 頁
字號:
int rt_task_ipc_init(RT_TASK_IPC *task, void (*fn)(int data), int data,  int stack_size, int priority){  /* initially task is not blocked on a semaphore */  int ret;  task->sem_at = NULL;  task->magic = RT_TASK_IPC_MAGIC;  ret = rt_task_init(MAKE_RT_TASK(task), fn, data, stack_size, priority);  if (ret < 0) {	  return ret;  }  (*MAKE_RT_TASK(task))->user[IPC_DATA_INDEX] = task;  return 0;}/************************************************************************* * rt_task_ipc_delete -- rt_ipc version of rt_task_delete() * * RT-Linux programs using rt_ipc should use rt_task_ipc_delete instead of * rt_task_delete().  It removes the task from any semaphore or message queue * it is in, then calls rt_task_delete().  Note that its parameter is an * RT_TASK_IPC instead of an RT_TASK. * * Returns 0 if successful, or -EINVAL if 'task' does not refer to a valid * task. *************************************************************************/int rt_task_ipc_delete(RT_TASK_IPC *task){  int ret = 0;  if (task->magic != RT_TASK_IPC_MAGIC)    ret = EINVAL;  else  {    /* for task deletion safety, must remove task from any sem or mq list */    int flags;    rtl_critical(flags);    if (task->sem_at != NULL)      unlink_sem_task(&(task->rte), task->sem_at);    else if (task->mq_at != NULL)      unlink_mq_task(&(task->rte), task->mq_at);    rtl_end_critical(flags);    ret = rt_task_delete(MAKE_RT_TASK(task));  }  return ret;}/************************************************************************* * rt_task_delay -- delay task  * * Delays the calling task until the time specified in 'duration'. * * Always returns 0. *************************************************************************/int rt_task_delay(RTIME duration){  int ret = 0;  int flags;	  rtl_critical(flags);  /* mark the task as delayed */  pthread_self()->period = 0;  RTL_MARK_SUSPENDED(pthread_self());  __rtl_setup_timeout(pthread_self(), HRT_FROM_8254(duration));  /* set the time at which execution may resume */  rtl_schedule();  rtl_end_critical(flags);  return ret;}/************************************************************************* * rt_mq_init -- initialize a real-time message queue * * Called to initialize a real-time message queue.  'mq' must point to a * statically allocated structure.  'max_msgs' is the maximum number of * messages allowed, and 'msg_size' is the size of each message. * * Returns 0 if successful, -ENOMEM if space for the queue could not be * allocated, or -EINVAL if called incorrectly. *************************************************************************/int rt_mq_init(rt_mq_t *mq, int max_msgs, int msg_size){  int ret = 0;  if (max_msgs <= 0 || msg_size < 0)    ret = -EINVAL;		/* must be positive */  else  {    mq->magic = RT_MQ_MAGIC;    mq->wait_list = NULL;    mq->max_msgs = max_msgs;    mq->msg_size = msg_size;    /* for efficiency, the max size of the queue data is allocated */    /* all in one piece at init time */    if ((mq->q = kmalloc(max_msgs * msg_size, GFP_KERNEL)) == NULL)      ret = -ENOMEM;    else    {      mq->status = RT_MQ_EMPTY;      mq->f = mq->r = mq->q;		/* initialize queue pointers */    }  }  return ret;}/************************************************************************* * rt_mq_destroy -- remove a real-time message queue * * Removes a message queue previously created with rt_mq_create().  Message * queue deletion safety is implemented; i.e., any tasks blocked on this  * message queue when it is destroyed are allowed to run. * * Returns 0 if successful, -EINVAL if 'sem' is not a valid rt_sem_t. *************************************************************************/int rt_mq_destroy(rt_mq_t *mq){  int ret = 0;  if (mq->magic != RT_MQ_MAGIC)    ret = -EINVAL;  else  {    /* unblock any tasks blocked on this message queue */    while (rt_mq_send(mq, NULL, RT_MQ_NORMAL, RT_NO_WAIT) != 0)      ;    while (rt_mq_receive(mq, NULL, RT_NO_WAIT) != 0)      ;    kfree_s(mq->q, mq->max_msgs * mq->msg_size);  }  return ret;}/************************************************************************* * enqueue -- enqueue data * * Enqueues a block of data on the queue 'mq' with priority 'prio'. * An RT_MQ_NORMAL block goes to the rear of the queue, while an RT_MQ_URGENT * block goes to the front.  The status is set appropriately as RT_MQ_FULL * or RT_MQ_NEITHER.  enqueue() should not be called when RT_MQ_FULL. *************************************************************************/static void enqueue(rt_mq_t *mq, char *msg, RT_MQ_PRIO prio){  if (prio == RT_MQ_NORMAL)  {    if (msg != NULL)      memcpy(mq->r, msg, mq->msg_size);    /* check for wraparound */    if ((mq->r += mq->msg_size) == mq->q + mq->msg_size * mq->max_msgs)      mq->r = mq->q;  }  else	/* prio == RT_MQ_URGENT */  {    /* check for wraparound */    if (mq->f == mq->q)      mq->f = mq->q + mq->msg_size * (mq->max_msgs- 1) ;    else      mq->f -= mq->msg_size;    if (msg != NULL)      memcpy(mq->f, msg, mq->msg_size);  }  if (mq->f == mq->r)		/* queue is now full */    mq->status = RT_MQ_FULL;  else    mq->status = RT_MQ_NEITHER;}/************************************************************************* * dequeue -- dequeue data * * Dequeues a block of data from the queue 'mq'.  The status is set * appropriately as RT_MQ_EMPTY or RT_MQ_NEITHER.  dequeue() should not * be called when RT_MQ_EMPTY. *************************************************************************/static void dequeue(rt_mq_t *mq, char *msg){  if (msg != NULL)    memcpy(msg, mq->f, mq->msg_size);  /* check for wraparound */  if ((mq->f += mq->msg_size) == mq->q + mq->msg_size * mq->max_msgs)    mq->f = mq->q;  if (mq->r == mq->f)		/* queue is now empty */    mq->status = RT_MQ_EMPTY;  else    mq->status = RT_MQ_NEITHER;}/************************************************************************* * rt_mq_send -- message queue send operation * * Enqueues the data 'msg' on the message queue 'mq'.  The data is assumed * to be of the size with which rt_mq_init() was called.  If 'prio' is * RT_MQ_NORMAL, the data is queued at the end. If 'prio' is RT_MQ_URGENT, * the data is forced to the front of the queue.  'wait' specifies an * optional timeout period.  If 'wait' is RT_NO_WAIT, rt_mq_send() * returns immediately even if no space for the message is present.  If * 'wait' is RT_WAIT_FOREVER, no timeout occurs.  If 'wait' is any other * value, it reflects the time at which rt_mq_send() will wake up and * return with -ETIME. * * Returns 0 if successful, -ETIME if the operation timed out, -EAGAIN if * RT_NO_WAIT was specified and the operation could not be completed * immediately, or -EINVAL if the rt_mq_t is not valid. *************************************************************************/int rt_mq_send(rt_mq_t *mq, char *msg, RT_MQ_PRIO prio, RTIME wait){  int ret = 0;  if (mq->magic != RT_MQ_MAGIC)    ret = -EINVAL;		/* invalid rt_mq_t structure */  else  {    int flags;    rtl_critical(flags);    switch (mq->status)    {    case RT_MQ_FULL:	/* q full -- this task must wait */    {      if (wait == RT_NO_WAIT)        ret = -EAGAIN;	/* can't queue it -- just report error */      else	/* wait is allowed */      {        RT_TASK_ENTRY *to_add = &(((RT_TASK_IPC *)rtl_current)->rte);        /* put task on wait_list */        to_add->task = rtl_current;        to_add->prev = NULL;        to_add->next = mq->wait_list;        if (to_add->next != NULL)          to_add->next->prev = to_add;        mq->wait_list = to_add;        /* indicate which mq the task is blocked at */        ((RT_TASK_IPC *)rtl_current)->mq_at = mq;        if (wait == RT_WAIT_FOREVER)          rt_task_suspend(rtl_current);	/* suspend until receive */        else        {          /* assume call timed out.  If this is not the case, */          /* rt_mq_receive() will clear this flag */          ((RT_TASK_IPC *)rtl_current)->timed_out = 1;          /* delay until either receive occurs or timeout occurs */          rt_task_delay(wait);          if (((RT_TASK_IPC *)rtl_current)->timed_out)          {            /* timed out -- undo everything and return */            unlink_mq_task(to_add, mq);            ret = -ETIME;            break;          }        }        /* when again allowed to run, enqueue the data */        enqueue(mq, msg, prio);		/* finally, enqueue the data */      }      break;    }    case RT_MQ_EMPTY:	/* q empty -- this operation might unblock a task */    {      RT_TASK_ENTRY *t, *to_run;      enqueue(mq, msg, prio);	/* first, go ahead and enqueue the data */      /* find the waiting task with the highest priority */      /* search exhaustively all waiting tasks.  I don't want to keep */      /* the list in priority order because I don't want to assume    */      /* the task priorities won't change.                            */      for (t=mq->wait_list, to_run=NULL ; t!=NULL ; t=t->next)        if (to_run == NULL || GET_PRIO(t->task) < GET_PRIO(to_run->task))          to_run = t;      if (to_run != NULL)      {        /* remove the task to be run from the wait_list */        unlink_mq_task(to_run, mq);        /* mark that task as no longer waiting at mq */        ((RT_TASK_IPC *)(to_run->task))->mq_at = NULL;        /* rt_mq_receive() will return because of a send, not */        /* because of a timeout */        ((RT_TASK_IPC *)(to_run->task))->timed_out = 0;        rt_task_wakeup(to_run->task);      }      break;    }    case RT_MQ_NEITHER:		/* space exists for new entry -- put it in */      enqueue(mq, msg, prio);      break;    }    rtl_end_critical(flags);  }  return ret;}/************************************************************************* * rt_mq_receive -- message queue receive operation *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美喷水一区二区| 亚洲一区二区视频在线| 精品国产网站在线观看| 宅男在线国产精品| 91精品欧美一区二区三区综合在| 欧美中文字幕一区二区三区| 欧美午夜寂寞影院| 欧美日韩综合不卡| 欧美日韩成人在线一区| 91精品婷婷国产综合久久竹菊| 欧美男生操女生| 日韩亚洲欧美中文三级| 日韩一区二区免费视频| 欧美电影免费观看高清完整版在线 | 欧美激情一区二区三区蜜桃视频| 26uuu精品一区二区| 久久久久久久久伊人| 国产欧美日韩激情| 亚洲天堂网中文字| 一区二区三区高清在线| 丝袜脚交一区二区| 蜜桃精品视频在线| 国内一区二区视频| 粉嫩aⅴ一区二区三区四区五区| 国产成人小视频| 99在线视频精品| 欧美日免费三级在线| 欧美不卡一区二区三区四区| 久久亚区不卡日本| 中文字幕一区二区三| 亚洲一区二区三区四区在线观看 | 久久精品视频免费| 亚洲欧美另类久久久精品| 亚洲一二三专区| 美女视频一区在线观看| 丁香另类激情小说| 欧美视频精品在线观看| 欧美成人性战久久| 中文字幕一区二区三区乱码在线 | 亚洲影院久久精品| 秋霞影院一区二区| 国产91色综合久久免费分享| 91免费在线播放| 欧美一区二区三区四区视频| 中文字幕第一区二区| 午夜精品福利一区二区三区蜜桃| 久久国产欧美日韩精品| 色综合av在线| 日韩精品在线一区二区| 综合中文字幕亚洲| 日韩精品视频网站| 成人国产免费视频| 日韩限制级电影在线观看| 欧美国产日韩亚洲一区| 亚洲国产一二三| 国产成人免费视频网站| 欧美人狂配大交3d怪物一区| 国产精品每日更新| 日韩va亚洲va欧美va久久| eeuss国产一区二区三区| 6080日韩午夜伦伦午夜伦| 综合电影一区二区三区| 久久精品国产99国产精品| 91免费观看视频| 久久这里只有精品首页| 亚洲福利视频一区二区| 成人午夜视频免费看| 日韩一区二区精品葵司在线| 一区二区三区加勒比av| 成人永久免费视频| 日韩视频免费观看高清完整版 | 91麻豆国产自产在线观看| 日韩精品在线看片z| 亚洲成人免费在线观看| 99久久免费精品高清特色大片| 欧美成人乱码一区二区三区| 亚洲一区在线观看视频| 高清av一区二区| 日韩精品中文字幕一区| 天堂久久一区二区三区| 色94色欧美sute亚洲线路二| 日本一区二区动态图| 精品无人码麻豆乱码1区2区| 欧美精品少妇一区二区三区| 亚洲欧美影音先锋| 国产v综合v亚洲欧| 久久免费看少妇高潮| 美女诱惑一区二区| 欧美精品99久久久**| 亚洲一二三区在线观看| 欧洲一区二区三区免费视频| 1000部国产精品成人观看| 国产激情精品久久久第一区二区| 欧美videossexotv100| 日本中文字幕一区二区有限公司| 欧美日免费三级在线| 一区二区三区产品免费精品久久75| 9l国产精品久久久久麻豆| 国产欧美精品国产国产专区| 国产xxx精品视频大全| 国产日韩综合av| 国产不卡在线视频| 久久精品一区二区三区不卡牛牛 | 精品三级在线看| 蜜臀国产一区二区三区在线播放 | 中文无字幕一区二区三区| 韩国三级中文字幕hd久久精品| 日韩女优制服丝袜电影| 久久99热这里只有精品| 欧美精品一区二区三区视频| 麻豆国产精品官网| 久久人人97超碰com| 国产精品一级黄| 国产精品女主播av| 色综合色狠狠天天综合色| 洋洋av久久久久久久一区| 欧美三日本三级三级在线播放| 亚洲成人第一页| 欧美一级理论片| 国产精品一区二区久激情瑜伽| 日本一区二区视频在线观看| 成人精品国产一区二区4080| 亚洲色大成网站www久久九九| 91福利视频网站| 午夜免费欧美电影| 精品国产乱码久久久久久浪潮| 国产一区啦啦啦在线观看| 国产视频在线观看一区二区三区| 久久综合色8888| 国产成人精品亚洲777人妖| 国产精品短视频| 91国偷自产一区二区开放时间| 丝袜亚洲另类丝袜在线| 精品日韩一区二区三区免费视频| 成人av在线观| 亚洲国产精品一区二区www| 日韩欧美一区二区视频| 国产91丝袜在线播放0| 亚洲一区在线视频观看| 精品三级在线看| 色综合视频在线观看| 视频一区二区中文字幕| 韩国中文字幕2020精品| 亚洲人妖av一区二区| 欧美精三区欧美精三区| 国产a视频精品免费观看| 亚洲综合激情另类小说区| 日韩欧美一区在线观看| 91视频免费观看| 日韩av一区二区三区四区| 久久精品一区二区三区不卡牛牛| 在线一区二区三区四区五区| 毛片不卡一区二区| 中文字幕日韩一区| 欧美一区二区三区人| 成人av免费网站| 麻豆91精品91久久久的内涵| 自拍视频在线观看一区二区| 日韩精品一区二区三区视频 | 日韩一区二区不卡| 99精品视频一区二区三区| 日韩精品国产精品| 亚洲图片激情小说| 精品国产一二三| 欧美专区亚洲专区| 成人高清视频在线观看| 免费日本视频一区| 亚洲欧美日韩国产中文在线| 精品国内二区三区| 欧美日韩亚洲国产综合| 成人免费va视频| 久久精工是国产品牌吗| 亚洲最大成人综合| 国产精品的网站| 久久久天堂av| 日韩欧美国产高清| 欧美视频在线不卡| 成人av电影在线网| 国产一区二区中文字幕| 天堂精品中文字幕在线| 一区二区三区四区高清精品免费观看 | 欧美另类videos死尸| 99久久精品99国产精品| 国产福利一区二区三区| 美女爽到高潮91| 日日夜夜一区二区| 亚洲一区二区在线视频| 国产精品国产三级国产aⅴ入口| 精品乱人伦小说| 欧美大胆人体bbbb| 亚洲一区二三区| 亚洲在线视频网站| 亚洲天堂中文字幕| 国产精品久久久久久久第一福利 | 一区二区高清视频在线观看| 亚洲欧洲日韩在线| 国产精品美女视频| 国产欧美精品国产国产专区| 国产日韩欧美高清在线| 欧美精品一区男女天堂|