title: RTOS - passing allocating a struct and passing it through a queue
body: <p>I've been having some issues with a couple of tasks I'm running. I have three tasks, where one is an LCD update task, and the other two are motor driver tasks. I also have two ISR's that post messages to both the motor driver tasks. As far as passing pointers safely, I was thinking about creating a struct:</p>
  
  <pre><code>  typedef struct message{
    enum BUTTON_1 = 0, BUTTON_2 = 1, NO_BUTTON = 3; //button ISR to increase motor drive  
    int timestamp; //A timestamp for the RPM of the motors
    }
  </code></pre>
  
  <p>Now the issue with shared memory comes in, so I was thinking:</p>
  
  <pre><code>  struct message* update_msg = (struct message*)malloc(sizeof(struct message)); //from here I dont know how to creat an object that fills the space allocated.
  </code></pre>
  
  <p>I would then send the pointer to the struct through the queue:</p>
  
  <pre><code>  OSTASKQPOST((void *)(st_size)
    ....
    )
  </code></pre>
  
  <p>At the end after the last task gets the message and does what it needs to with the member variables, I would have to deallocate the memory.</p>
  
  <pre><code>  free(st_size)
  </code></pre>
  
  <p>Would something like this be plausible?</p>