Thread: Exchange data between tasks

  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    13

    Exchange data between tasks

    I have this doubt, i am using freertos to create tasks. There is always one task which is active. It will trigger other tasks based on the external serial data uart. Say i received data as 1 and run Task1, if i receive data as 2 i run Task2. But before running Task2 i want to confirm if Task1 has exited properly. I am not sure how to do. Please advise.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,663
    Use a mutex.

    Or call this yourself from the base task.
    This page describes the RTOS vTaskDelete() FreeRTOS API function which is part of the RTOS task control API. FreeRTOS is a professional grade, small footprint, open source RTOS for microcontrollers.

    > i want to confirm if Task1 has exited properly.
    Can a task exit improperly?
    Would an error be an improper exit?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    13
    Quote Originally Posted by Salem View Post
    Use a mutex.
    > i want to confirm if Task1 has exited properly.
    Can a task exit improperly?
    Would an error be an improper exit?
    I think i have not explained properly. What i want to convey is before running Task2, the Task1 may require some time to perform its closing activities before it is abruptly stopped and the other task gets started. I want the main task to confirm that the Task1 has done all its closing activities.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,663
    Why are you bothering with more than one task, if they run mutually exclusively anyway?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with 2 c++ tasks.
    By Vadim Polukejev in forum C++ Programming
    Replies: 4
    Last Post: 06-16-2015, 07:54 AM
  2. data structure for currencies exchange
    By underthesun in forum C++ Programming
    Replies: 1
    Last Post: 03-21-2009, 04:01 AM
  3. Memory data share/exchange
    By intmail in forum Linux Programming
    Replies: 3
    Last Post: 08-16-2006, 06:47 AM
  4. XML and data exchange
    By seexml in forum C Programming
    Replies: 0
    Last Post: 04-27-2006, 03:02 PM
  5. C++ tasks
    By Womble in forum C++ Programming
    Replies: 4
    Last Post: 06-15-2003, 02:15 PM

Tags for this Thread