Chapter 12. Thread Communication with Message Queue. Outline. Brief Introduction to Message Queue Look into Message Queue Control Block Investigate Message Queue Service 4 Public Resources vs. ThreadX Applications. Brief Introduction to Message Queue.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Thread Communication with Message Queue
void tx_application_define(void *first_unused_memory)
tx_thread_create(&speedy_thread, "speedy_thread", speedy_thread_entry, 0, stack_speedy, STACK_SIZE, 5, 5, TX_NO_TIME_SLICE, TX_AUTO_START);
tx_thread_create(&slow_thread, "slow_thread", slow_thread_entry, 1, stack_slow, STACK_SIZE, 15, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
tx_queue_create (&my_queue, "my_queue", QUEUE_MSG_SIZE, queue_storage, QUEUE_TOTAL_SIZE);
msg_arr[QUEUE_MSG_SIZE-1] = 1;
status = tx_queue_send(&my_queue, msg_arr, TX_WAIT_FOREVER);
printf("the status is %d\n", status);
tx_timer_create (&stats_timer, "stats_timer", print_stats, 0x1234, 500, 500, TX_AUTO_ACTIVATE);
QUEUE_TOTAL_SIZE = (tx_queue_end) – (tx_queue_start)0x426f10 – 0x426d80 = 0x190 (400 bytes)
tx_queue_read becomes 0x426f0c, which is 4 bytes in front of tx_queue_end.
tx_queue_read is back to tx_queue_start
Source Code 1 Link
Result is the same as the counting semaphore for event notification application (producer-consumer) at p.158
Source Code 2 Link
Totally the same as using Event Flags Group at p.178
Source Code 3 Link