This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Multiple MessageQ reader threads in SysLink

I'd like to create a thread pool handling messages transmitted via MessageQ. Is it valid to call MessageQ_get() on a single message queue in multiple threads/tasks simultaneously? MessageQ documentation states that "Each message queue has one reader and can have many writers", but also "MessageQ supports reads/writes of different thread models", so I'm a little confused.

  • Hi,

    What it means is that more than one thread (say thread2 and thread3) can open a MessageQ (lets say it's msgQ1 created in thread1), so all of those threads (2 and 3) can write to msgQ1, but you can do a MessageQ_get(msgQ1,...) only inside thread1. Also keep in mind that when a message is put it doesn't belong to that thread anymore, so if you put a message (msgA) from thread2 to msgQ1 you can't access it in thread2 until it's returned to thread2 (you may also free it and recreate). And you can do this with threads in the same core or in different ones.

    Regards

    J

  • Additional "MessageQ supports reads/writes of different thread models" means that the reader (and writers) can be a Task, Swi or even a Hwi (the latter two have non-blocking restrictions).

    Todd