1

我在使用 Keil rtx 消息队列时遇到问题。我有以下两个线程:send_thread 和 receive_thread。

伪代码:

send_thread
{
int16_t array1[20];
int16_t array2[20];
int16_t array3[20];

int16_t *common_array[3]

common_array[0] = array1;
common_array[1] = array2;
common_array[2] = array3;

osMessagePut(MsgBox, (uint32_t)common_array, osWaitForever);
}

receive_thread
{
int16_t receive_array1[20];
int16_t receive_array2[20];
int16_t receive_array3[20];

int16_t *receive_common_array[3]

MsgBox_status = osMessageGet(MsgBox, osWaitForever);

//now here I want to copy all arrays from send_thread to received_arrays.

receive_common_array = MsgBox_status.value.p;  //here I should copy the received adress to a new pointer, but I have received just void* variable, so I can't assign like that

memmove(receive_array1, receive_common_array[0], 20);
memmove(receive_array2, receive_common_array[1], 20);
memmove(receive_array3, receive_common_array[2], 20);

}

所以问题是出了什么问题或者我应该如何实现它?我已经调试了地址,我得到了相同的地址。不同之处在于,在 send_thread 中,发送变量是指向指针数组的指针,但在 receive_thread 中只有 void*,我无法访问其中的任何值。

欢迎任何建议。

4

0 回答 0