,Newlib-none C++ exceptions and thread safety

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

,Newlib-none C++ exceptions and thread safety

967 次查看
v_canoz
Contributor III

Hello

We’ve been using Freertos for 1 year for our embedded projects and we really love it.
A bit of context : our main target is a Cortex M33 (LPC55S69) which has plenty of flash and RAM.

We’ve started to port our C code base to C++ and we wonder if we can enable the C++ exceptions safely with the Freertos multithreaded environnement?

I asked Freertos forums guys about this and they told me it depends on the newlib implementation. So, by default, are newlib-none (not nano!) C++ exceptions thread-safe? I'm using heap_useNewlib from the great Dave Nadler.

After a few test, I have strange behaviors when several tasks runs in parallel, if I do throw / try / catch in them...

What do I need to do exactly to be able to use them safely in a multi threaded environnement?

Many thanks,

Victor

1 回复

930 次查看
gusarambula
NXP TechSupport
NXP TechSupport

Hello Victor,

I confirmed with our experts that Newlib does feature thread safely by itself. You would need to work with FreeRTOS to allow the implementation to be thread safe.

They actually pointed to the implementation from Dave Nadler as reference. We do not have a FreeRTOS example with thread safety implemented.

My apologies for the inconvenience.

Regards,
Gustavo

0 项奖励
回复