On Tuesday 17 February 2015 12:54:04 Hudson, Douglas wrote:
> A little bit of history regarding the C stack.  It was implemented first and
> wasn't originally intended to be thread-safe.  The initial thought was that
> that would allow it to run efficiently and have less of a footprint on a
> bare-metal micro with no RTOS (i.e. single threaded).  If an app wanted to
> use threads, then the app should provide a mutex based on its OS/RTOS and
> serialize access to the C stack.  The C++ layer did this for devices that
> weren't resource constrained.
> 
> Early implementation goals for the C stack were:
> - to be as small as possible so that we could run on a wide variety of
> constrained devices 
> - RTOS/OS agnostic

Hi Doug

I understand the constraints and the design goals, but I don't understand how 
it follows from those that the design had to be thread-unsafe.

If you rip out all globals and store everything in context objects, you've 
made it reentrant without using any threading library. As a bonus, you've also 
made it possible for multiple users to use the library in the same process.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Reply via email to