Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hi all,
I am trying to fill queue with messages. After filling some messages, i will iterate queue and remove some messages on any spesific place(middle, tail or head). When i try removing messages with this code in below, program crashes after some time.
if (!Queue_empty(outgoingMsgQueue)) { Queue_Elem *pRec; pRec = Queue_head(outgoingMsgQueue); for (pRec = Queue_head(outgoingMsgQueue); pRec != (Queue_Elem *) outgoingMsgQueue; pRec = Queue_next(pRec)) { queueRec_t * questr = (queueRec_t*) pRec; sbpUARTEvt_t *pMsg = (sbpUARTEvt_t *) questr->pData; if (pMsg) { Queue_remove(pRec); ICall_free(pRec); ICall_freeMsg(pMsg->pData); ICall_free(pMsg); } } }
It goes HWI in Queue_remove(pRec);
HW exception :
In Queue.c 219:
qelem->next->prev = qelem->prev;
This line occurs hardware fault. According to Runtime Object view.
But when i try with this, it works properly
if (!Queue_empty(outgoingMsgQueue)) //no ack msg but there are msgs sent { Queue_Elem *pRec; pRec = Queue_head(outgoingMsgQueue); queueRec_t * questr = (queueRec_t*) pRec; sbpUARTEvt_t *pMsg = (sbpUARTEvt_t *) questr->pData; if (pMsg) { Queue_remove(pRec); ICall_free(pRec); ICall_freeMsg(pMsg->pData); ICall_free(pMsg); } }
So, when i iterate with for loop, program stucks after some time . What can be the problem ?
Best regards.