This site required JavaScript
to be enabled. Click here to
view a static menu.
FreeRTOS+POSIX is provided under the MIT open source license by Amazon Web Services.
We encourage you to give FreeRTOS+POSIX a try, but please be aware when doing so that the code is still in the lab, which means we have not yet completed our review and test quality control processes. Please use the forum for support, or contact us directly if you have a specific business interest.
On this page:
This demo creates two types of actors: dispatcher and workers. Dispatchers tell workers what to do by sending different types of messages to the works. Each time a worker receives a message it performs a predefined routine that is dependent on the message it received. At the end of the demo the dispatcher notifies the workers that there is nothing more to do and all actors (dispatcher and worker) terminate.
Each actor is a thread that is created using the POSIX pthread_create() function. Messaging is performed through queues using the POSIX mq_open(), mq_send(), mq_timedsend() and mq_receive() functions.
gcc -Wall posix_demo.c -lpthread -lrt -o posix_demo
./posix_demo
...
Note that FreeRTOS cannot return from main() without ending the entire application, so the native FreeRTOS API is used to create a task called vStartPOSIXDemo(), which then used to run the same actor demo as already demonstrated running on Linux.