How to use a queue to post and read values from two different functions?

I have three functions (task4, task5 and task7). How can I use a queue to post and read the values from tasks 5 and 7?
I am using ESP32 and the Arduino IDE. This is my code:

byte POT_GPIO = 33; //analogue input
unsigned short int analg_val;//store analogue value

unsigned short int new_analg_val ;
unsigned short int filter_analg_val;//averaged analogue value

bool error_code;//high when average analogue input is greater than half its maximum range

//Task4 - Read analogue input using pot
void Task4() {
  analg_val = analogRead(POT_GPIO);
}

//Task5 - Compute filtered analogue value
void Task5() {
  new_analg_val = 0;
  for (int i = 0; i <= 3; i++) { //take 4 readings
    Task4();
    new_analg_val = new_analg_val + analg_val;
  }
  filter_analg_val = new_analg_val / 4; //average of the last 4 readings
  Serial.println(filter_analg_val);
}

//Task7 - Perform error check
void Task7() {
  if (filter_analg_val > (0.5 * 4095)) { //4095 represents the max voltage
    error_code = 1;
  }
  else {
    error_code = 0;
  }
  Serial.println(error_code);
}
void setup() {
  Serial.begin(9600);
  pinMode(POT_GPIO, INPUT);
}

void loop() {
  Task5();
  Task7();
}

Chapter 4 in this book provides details about FreeRTOS queues: https://www.freertos.org/fr-content-src/uploads/2018/07/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf

This page documents FreeRTOS queue API - FreeRTOS - FreeRTOS queue API functions, including source code functions to create queues, send messages on queues, receive messages on queues, peek queues, use queues in interrupts.

Thanks.