openthread / ot-commissioner

OpenThread Commissioner, a Thread commissioner for joining new Thread devices and managing Thread networks.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
52 stars 35 forks source link

[cli] fix signal handling #138

Closed wgtdkp closed 4 years ago

wgtdkp commented 4 years ago

Synchronization primitives (std::mutex, std::future) in namespace std are used to synchronize calls to the commissioner API. Unfortunately, those synchronization primitives are not signal-safe and will result in deadlock.

This PR fixes this by using a dedicated thread to wait for the signal.

codecov-commenter commented 4 years ago

Codecov Report

Merging #138 into master will increase coverage by 0.05%. The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master     #138      +/-   ##
==========================================
+ Coverage   64.77%   64.82%   +0.05%     
==========================================
  Files          52       52              
  Lines        4749     4754       +5     
==========================================
+ Hits         3076     3082       +6     
+ Misses       1673     1672       -1     
Impacted Files Coverage Δ
src/app/cli/main.cpp 93.75% <90.90%> (+4.86%) :arrow_up:
jwhui commented 4 years ago

@wgtdkp , please help resolve conflicts.

wgtdkp commented 4 years ago

@jwhui done.