This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC3200SDK: Why does Osi_MsgQRead copy data?

Part Number: CC3200SDK

Tool/software: TI-RTOS

I have pointers to data structure with a size of 2kB and I want to pass them between threads frequently. Writing is quite obvious. However reading seems to be not very clear since reading function has the following definition Osi_MsgQRead(OsiMsgQ_t *queue, void* pMsg, OsiTime_t timeout). As I can see the second parameter is just a pointer to void which ensures me that data from the written pointer is copied into the passed pointer. Therefore a natural question arises: why not to accept void **ptr and just save the written pointer in order to avoid making copies of data? Moreover it is embedded system where too much of copying can lead to a poor performance.

What about the issue, the only solution I can see now is to create a wrapper for my message pointer in the following way and pass it to the queue:

struct wrapper {
   MyMsg *msg;
}

Is there any better approach?