小弟初学ucos,恳请大神指教
问题描述:如下是建立一个消息队列的源码
OS_EVENT *OSQCreate (void **start, INT16U size)
{
OS_EVENT *pevent;
OS_Q *pq;
OS_ENTER_CRITICAL();
pevent = OSEventFreeList;
if (OSEventFreeList != (OS_EVENT *)0) {
OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
}
OS_EXIT_CRITICAL();
if (pevent != (OS_EVENT *)0) {
OS_ENTER_CRITICAL();
pq = OSQFreeList;/*从空闲队列控制块链表中取得一个空闲队列控制块*/
if (OSQFreeList != (OS_Q *)0) {/*指向非空,说明空闲链表中还有空闲队列控制块*/
OSQFreeList = OSQFreeList->OSQPtr;/*调整空闲队列链表的表头,使它指向下一个节点*/
}
OS_EXIT_CRITICAL();
if (pq != (OS_Q *)0) { /*如何理解这句?这个pq会指向哪里呢?(如下面这张图)*/
pq->OSQStart = start;
~~~~~~
|