PelionIoT / mbed-trace

mbed trace library
Apache License 2.0
18 stars 15 forks source link

Allow setting mutex locking/unlocking callbacks before trace init. #46

Closed tommikas closed 8 years ago

tommikas commented 8 years ago

Calling mbed_trace_init() set the callbacks to NULL so they had to be set after initializing the library. This left a small window of time during which traces could happen without any thread safety being in place.

tommikas commented 8 years ago

@RomanSaveljev @kjbracey-arm Could you review please.

RomanSaveljev commented 8 years ago

Do we need a mutex for mbed_trace_init and then a mutex for assigning mutex functions? :) I mean all this approach seems a little bit fishy to me (probably, because I am not really in the loop)..

tommikas commented 8 years ago

Currently the mutexes are only meant to protect the actual trace calls. Initialization and configuration aren't protected.

RomanSaveljev commented 8 years ago

Needs to be documented carefully, because of the "creativity window" we leave open for the user.

LGTM

tommikas commented 8 years ago

I'll add a little more documentation.

tommikas commented 8 years ago

@SeppoTakalo Could you take a look at this please.

SeppoTakalo commented 8 years ago

+1