Change-Id: I8975e7e5cd1fadf1dad493ee63d61d8f3f94862a
export CXXFLAGS="-O0 -g3"
V="V=1"
%endif
export CXXFLAGS="-O0 -g3"
V="V=1"
%endif
+export CXXFLAGS=$CXXFLAGS" -DTIZEN=1"
#include "speech_logs.h"
#define WINTHORP_SERVER_SOCKET "@winthorpe.w3c-speech"
#include "speech_logs.h"
#define WINTHORP_SERVER_SOCKET "@winthorpe.w3c-speech"
+#ifdef TIZEN
+// static
+void SpeechInstance::SetupMainloop(void* data) {
+ SpeechInstance* self = reinterpret_cast<SpeechInstance*>(data);
+
+ g_main_loop_run(self->main_loop_);
+}
+#endif // TIZEN
SpeechInstance::SpeechInstance()
SpeechInstance::SpeechInstance()
+#ifdef TIZEN
+ : main_loop_(g_main_loop_new(0, FALSE))
+ , thread_(SpeechInstance::SetupMainloop, this)
+ , fd_(-1)
+#else
+ : fd_(-1)
+#endif // TIZEN
, channel_(NULL)
, watcher_id_(0)
, pending_request_timer_(0)
, pending_reply_timer_(0) {
, channel_(NULL)
, watcher_id_(0)
, pending_request_timer_(0)
, pending_reply_timer_(0) {
+#ifdef TIZEN
+ thread_.detach();
+#endif // TIZEN
if ((fd_ = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
ERR("Failed to create socket: %s", strerror(errno));
fd_ = -1;
if ((fd_ = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
ERR("Failed to create socket: %s", strerror(errno));
fd_ = -1;
close(fd_);
if (channel_)
g_io_channel_unref(channel_);
close(fd_);
if (channel_)
g_io_channel_unref(channel_);
+
+#ifdef TIZEN
+ g_main_loop_quit(main_loop_);
+ g_main_loop_unref(main_loop_);
+#endif // TIZEN
void QueueRequest(const std::string& req);
bool SendRequest(const char* message);
uint32_t ReadReply(char** reply);
void QueueRequest(const std::string& req);
bool SendRequest(const char* message);
uint32_t ReadReply(char** reply);
+#ifdef TIZEN
+ static void SetupMainloop(void *data);
+ GMainLoop* main_loop_;
+ std::thread thread_;
+#endif // TIZEN
std::queue<std::string> pending_replies_;
std::queue<std::string> pending_requests_;
std::queue<std::string> pending_replies_;
std::queue<std::string> pending_requests_;