Calling a funtion from two tasks

i am working on luminary micro kit LM-EV3S811. I am using FreeRtos for my application. I have used a display funtion which prints on screen. But should I make sure that only one task can call the function at a time. If do dont make any provision to restrict the calling of function by one task (by a semaphore) will 1)the program hang 2)will display a mix message 3)any other

Calling a funtion from two tasks

You have to serialize access to the display just like any other resource in your system.  Take a look at FreeRTOSDemoCORTEX_LM3S811_KEILmain.c – it shows you one way of doing what you want on the same hardware you are using.  The task vPrintTask() is the only task that accesses the LCD.  Other tasks that want to print things to the LCD send their text to vPrintTask() and do not write to the LCD directly.  The comments at the top of the file explain it further. The alternative method would be to use a semaphore to provide mutual exclusion to the LCD but this would not be recommended as writing messages to the LCD is a lengthy process and you would potentially get into problems with priority inversion. Dave.