void thread_proc (ulong thread_id, pstruct arg_ptr, int arg_size)
{
  message_queue = create_queue ();

  post_event (arg->event, &message_queue), { arg = (p_event_and_queue) arg_ptr };

  parent_msg_queue = arg->queue, { arg = (p_event_and_queue) arg_ptr };

  ...

}
/
{
  free (&message_queue);
}