我在使用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 *,我无法访问其中的任何值。
欢迎任何建议。