Hello Guys,
I am using two threads and i want to take value of a function from one thread and use it in other.
I am not good at the concepts of threads.
Here is the following code:
Code:
void ThreadA(void const *argument)
{
uint32_t status = I2S002_FAIL;
status = I2S002_Config(&I2S002_Handle0, &I2SConfig_U0C1_A);
if (status != DAVEApp_SUCCESS)
{
while (1);
}
while (1) {
status = I2S002_RegisterTxPPBuf(&I2S002_Handle0, (uint32_t*) TXBuf,PLen);
}
....
....
}
void ThreadB(void const *argument)
{
FILE *ptr;
uint16_t result, block_size;
uint16_t num_blocks;
status_t status1 ;
status_t Status ;
block_size = sizeof(temp_buffer);
num_blocks = sizeof(char);
Status = mount(0, &myfsObject);
if(Status != DAVEApp_SUCCESS)
{
while(1);
}
ptr = fopen("test.raw", "r+");
fseek(ptr, 0, SEEK_SET);
result = fread(&temp_buffer, num_blocks, block_size, ptr);
if(result == 0)
{
while(1);
}
status1 = fclose(ptr);
return;
}
int main(void)
{...
...
ThreadId = osThreadCreate(osThread(ThreadB),NULL);
osKernelStart();
ThreadC_id = osThreadCreate(osThread(ThreadA), NULL);
osKernelStart();
...
...
}
So, i want to use the return value of temp_buffer from ThreadB into Thread C and want to put this value to TXBuf in ThreadA...
any help would be highly appreciated
Thanks