typedef void * xQueueHandle; and ansi c

kolodko1 wrote on Saturday, January 31, 2009:

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

rtel wrote on Saturday, January 31, 2009:

I think technically you are correct, you may need a volatile on the definition, depending on the compiler and optimisation level used.

Regards.

kolodko1 wrote on Monday, February 02, 2009:

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