[Callhistory] Fix for find method 96/158396/6
authorPawel Kaczmarczyk <p.kaczmarczy@partner.samsung.com>
Tue, 31 Oct 2017 12:53:47 +0000 (13:53 +0100)
committerPawel Kaczmarczyk <p.kaczmarczy@partner.samsung.com>
Thu, 2 Nov 2017 14:10:33 +0000 (15:10 +0100)
[Bug] LoadPhoneNumbers must be called before FindThread.
  Because of critical section of LoadPhoneNumbers lasts for
  whole scope, so they can be called sequentially.

[Verification] Passrate 100%

Change-Id: I8207f488f0f4926d70d2289d42b1a46d2b98ee75
Signed-off-by: Pawel Kaczmarczyk <p.kaczmarczy@partner.samsung.com>
src/callhistory/callhistory.cc

index f531118870feab70f1709162a59ff29fc3d94ee8..1108c80da692906e1cac81f0f92d421a8cc43360 100644 (file)
@@ -305,8 +305,11 @@ void CallHistory::LoadPhoneNumbers(const picojson::object& args, CallHistory* ca
 
 void CallHistory::find(const picojson::object& args) {
   ScopeLogger();
-  std::thread(LoadPhoneNumbers, args, this).detach();
-  std::thread(FindThread, args, this).detach();
+  std::thread([args, this]() {
+    ScopeLogger("Entered into asynchronus function, std::thread's argument");
+    LoadPhoneNumbers(args, this);
+    FindThread(args, this);
+  }).detach();
 }
 
 PlatformResult CallHistory::remove(const picojson::object& args) {