Closed kuggenhoffen closed 8 years ago
@kjbracey-arm @tommikas @jupe
@TeroJaasko
Isn't this a bit weird anyway? Why the count?
This function claimed the mutex exactly once, so it should release it exactly once. Surely?
(PS welcome to the wonderful world of threading. So many really hard to figure out bugs like this...)
I guess the idea was to get the mutex from mbed_trace_array and leave it for mbed_trace_print to release. Use case would be something like this: "tr_info("hello %s", tr_array(pointer));"
Isn't this a bit weird anyway? Why the count?
I guess the idea was to get the mutex from mbed_trace_array and leave it for mbed_trace_print to release. Use case would be something like this: "tr_info("hello %s", tr_array(pointer));"
That was exactly the reason for it. The original discussion was here: https://github.com/ARMmbed/mbed-trace/pull/30
PS welcome to the wonderful world of threading. So many really hard to figure out bugs like this...
Yeah... The implication of the post-increment in the for loop seems obvious now, but never crossed my mind back then.
I think they are making mbed-os 5.2 release candidate possible today so we should push this there also asap
PR made for mbed-OS: https://github.com/ARMmbed/mbed-os/pull/2887
Fixes issue where mutex might be left locked when leaving mbed_vtracef function because of decreasing mutex_lock_count after releasing the mutex.