void CallHistory::find(const picojson::object& args) {
ScopeLogger();
- std::thread([args, this]() {
- ScopeLogger("Entered into asynchronus function, std::thread's argument");
+ common::TaskQueue::GetInstance().Async([args, this]() {
+ ScopeLogger("Entered into asynchronus function");
LoadPhoneNumbers(args, this);
FindThread(args, this);
- }).detach();
+ });
}
PlatformResult CallHistory::remove(const picojson::object& args) {
NetworkBearerSelectionManager::GetInstance()->requestRouteToHost(domain_name, response);
};
- common::TaskQueue::GetInstance().Async(request);
+ // The RequestRouteToHost has to be executed in the main thread because of Native API
+ // implementation. The Web API implementation of NBSManager class has a global connection_h
+ // handle, which is used in every Request() method.
+ // However, the Native implementation uses std::thread_local-like variables, thus
+ // an execution of RequestRouteToHost() in thread different than main thread results in returning
+ // an error from C-API.
+ common::TaskQueue::GetInstance().ScheduleWorkInMainThread(request);
ReportSuccess(out);
}
NetworkBearerSelectionManager::GetInstance()->releaseRouteToHost(domain_name, response);
};
- common::TaskQueue::GetInstance().Async(release);
+ // The ReleaseRouteToHost has to be executed in the main thread because of Native API
+ // implementation. The Web API implementation of NBSManager class has a global connection_h
+ // handle, which is used in every Request() method.
+ // However, the Native implementation uses std::thread_local-like variables, thus
+ // an execution of RequestRouteToHost/ReleaseRouteToHost() in thread different than main thread
+ // results in returning an error from C-API.
+ common::TaskQueue::GetInstance().ScheduleWorkInMainThread(release);
ReportSuccess(out);
}
#include "networkbearerselection_manager.h"
#include "common/logger.h"
#include "common/scope_exit.h"
+#include "common/task-queue.h"
#include <arpa/inet.h>
#include <netdb.h>
const PlatformResult result) {
ScopeLogger();
- std::thread(reply, result).detach();
+ auto reply_wrapper = [=] { reply(result); };
+ common::TaskQueue::GetInstance().Async(reply_wrapper);
}
void NetworkBearerSelectionManager::requestRouteToHost(const std::string& domain_name,
#include <thread>
#include "common/logger.h"
+#include "common/task-queue.h"
#include "common/tools.h"
#include "preference/preference_instance.h"
#include "preference/preference_manager.h"
callback(result, response);
};
- std::thread(get_all, callback).detach();
+ auto get_all_wrapper = [=] { get_all(callback); };
+
+ common::TaskQueue::GetInstance().Async(get_all_wrapper);
return common::TizenSuccess();
}
#include <thread>
#include "common/scope_exit.h"
+#include "common/task-queue.h"
#include "common/tools.h"
namespace extension {
this->Post(token, result);
};
- std::thread(get_readers, token).detach();
+ common::TaskQueue::GetInstance().Async(get_readers, token);
return TizenSuccess();
}
this->Post(token, result);
};
- std::thread(open_session, token).detach();
+ common::TaskQueue::GetInstance().Async(open_session, token);
return TizenSuccess();
}
this->Post(token, result);
};
- std::thread(open_basic_channel, token).detach();
+ common::TaskQueue::GetInstance().Async(open_basic_channel, token);
return TizenSuccess();
}
this->Post(token, result);
};
- std::thread(open_basic_logical, token).detach();
+ common::TaskQueue::GetInstance().Async(open_basic_logical, token);
return TizenSuccess();
}
this->Post(token, result);
};
- std::thread(transmit, token).detach();
+ common::TaskQueue::GetInstance().Async(transmit, token);
return TizenSuccess();
}
auto data = std::shared_ptr<picojson::value>(new picojson::value(picojson::object()));
- TaskQueue::GetInstance().Async<picojson::value>(get, data);
+ // Setting properties needs to be executed in main thread because of:
+ // "Internally, EFL uses data with TLSS(Thread Local Storage).
+ // Hence, there is no share data between Main thread and other thread."
+ TaskQueue::GetInstance().ScheduleWorkInMainThread<picojson::value>(get, data);
}
PlatformResult SystemSettingInstance::setPlatformPropertyValue(const std::string& settingType,
#include <widget_service.h>
#include "common/scope_exit.h"
+#include "common/task-queue.h"
#include "common/tools.h"
#include "widgetservice/widgetservice_utils.h"
this->Post(token, result);
};
- std::thread(get_widgets, token).detach();
+ common::TaskQueue::GetInstance().Async(get_widgets, token);
return TizenSuccess();
}
this->Post(token, result);
};
- std::thread(get_instances, token).detach();
+ common::TaskQueue::GetInstance().Async(get_instances, token);
return TizenSuccess();
}
}
};
- std::thread(get_variants, token).detach();
+ common::TaskQueue::GetInstance().Async(get_variants, token);
return TizenSuccess();
}
this->Post(token, TizenSuccess{response});
};
- std::thread(get_content, token).detach();
+ common::TaskQueue::GetInstance().Async(get_content, token);
return TizenSuccess();
}