typedef void * xQueueHandle; and ansi c
Hi
I have trivial question (I hope), I do not understand something.
situation:
task:
//=======================================
extern xQueueHandle xQueue; //ours queue
while(xQueue == NULL) //wait on till queue will be created in other task
{
delay(10);
}
xQueueSendToBack(xQueue,…);
(…)
//========================================
So we creating a queue in other task, this task just waiting on when queue is created. xQueueHandle is defined:
typedef void * xQueueHandle;
My doubts are: is it safe if to declare handler to queue like non volatile pointer? General rule is that volatile type should be for example:
"Global variables accessed by multiple tasks within a multi-threaded application"
I understand this like:
typedef void * volatile xQueueHandle;
What are yours thoughts ?
Kind Regards
/Greg
typedef void * xQueueHandle; and ansi c
I think technically you are correct, you may need a volatile on the definition, depending on the compiler and optimisation level used.
Regards.
typedef void * xQueueHandle; and ansi c
I checked 2 another RTOS and non of them declare non volatile pointers. It seems that neither compiler use such optimization, because is really unlike that no one report bug yet.
Regards