Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 11 months ago.
Global object destroyed when using rtos.h
Hello,
I'm trying to do communication system between a mobil phone and a ST-Nucleo F303RE. If I don't use the RTOS library, all is OK. But when I include the RTOS library to run a second thread, using the same global objects that I'm using on the main thread, the global objects are destroyed and the system stops.
Why a global object (declared outside main) is destroyed when I'm using RTOS? I saw a lot of examples using global objects and they're working.
Probably the code helps a lot:
Import programprojecte_v3_rtos
Serial communication between a F303RE and a mobile phone using a HC-05 BT.
When I run this code, I can see in the serial monitor: "Constructora\n Destructora\n" and this strings are included in the Constructor and Destructor functions of "Pc" class. Why the object is destroyed if it's in the global scope? This not happens if I don't use RTOS lib.
Thanks a lot,
Jose.